mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Compare commits
399 commits
Author | SHA1 | Date | |
---|---|---|---|
|
03db672b8f | ||
|
0030d609a4 | ||
|
b9aa064591 | ||
|
dacce186cf | ||
|
64fd9291ef | ||
|
bb47bc02f2 | ||
|
4d9cd906d3 | ||
|
742729ed29 | ||
|
60f34f8503 | ||
|
3fd7f174db | ||
|
df0aa5a815 | ||
|
1a1ae36f9a | ||
|
15ec8b8995 | ||
|
29e817b70e | ||
|
51a1598e4e | ||
|
fbaeba352e | ||
|
a470b2d375 | ||
|
d10ee46811 | ||
|
ae0a5913c8 | ||
|
0f7edaff73 | ||
|
ad4e723829 | ||
|
f94bc89108 | ||
|
b421abc7c3 | ||
|
11d0caa614 | ||
|
2b35979a1a | ||
|
72bb476bf3 | ||
|
630cfb5b79 | ||
|
ff0989e46b | ||
|
1b8f5965d3 | ||
|
b5d1b972cc | ||
|
a58579681c | ||
|
78e0cc778a | ||
|
c38427eea4 | ||
|
3a7b3082cf | ||
|
e55bde2133 | ||
|
f05244a8d5 | ||
|
f63bc2b5cc | ||
|
f31787d35d | ||
|
cc31510088 | ||
|
31dd1e39cb | ||
|
e169442c29 | ||
|
3ddfffda04 | ||
|
b58005a4da | ||
|
974351fe4a | ||
|
682f0515c9 | ||
|
874fa7bed4 | ||
|
7e419c2dd5 | ||
|
25f9222fed | ||
|
73f6e3a1b4 | ||
|
f239da06ec | ||
|
8f7f451c2a | ||
|
9736947af2 | ||
|
d0d55f3031 | ||
|
f0d79459d6 | ||
|
b4a970729b | ||
|
a27d6650ee | ||
|
445336aad9 | ||
|
7d76dceaad | ||
|
a081ba8b9c | ||
|
de276eb023 | ||
|
8225a7f554 | ||
|
c0585ad814 | ||
|
7215c89aa8 | ||
|
7081e76f5a | ||
|
e400cc93b7 | ||
|
a49c35b5dc | ||
|
5f3bab1a32 | ||
|
f5cf45d86e | ||
|
e81ad46b0e | ||
|
1cb8042961 | ||
|
de7c014e92 | ||
|
c0bfbb9692 | ||
|
9788e7e46a | ||
|
61440fc664 | ||
|
d3052f1f50 | ||
|
d806240dfe | ||
|
40031cfc4c | ||
|
310ace5dd0 | ||
|
93e8199078 | ||
|
a045081f73 | ||
|
4a3c9204ff | ||
|
6dab25ae4e | ||
|
e6d8308fde | ||
|
23cfd114d3 | ||
|
0b904a553a | ||
|
18a168bcd2 | ||
|
e43553af1e | ||
|
2faa8bc154 | ||
|
49e88310be | ||
|
294569e495 | ||
|
a936c10e2c | ||
|
40dbccf142 | ||
|
190906aeaf | ||
|
da3c35aa48 | ||
|
c963d24001 | ||
|
53c7e7c46f | ||
|
d750173b76 | ||
|
3d935e86d9 | ||
|
fffed5e809 | ||
|
d844312131 | ||
|
5588ae68c8 | ||
|
0452603a94 | ||
|
f4f2e1596b | ||
|
646881e7f9 | ||
|
17dfd0f808 | ||
|
9e838293c2 | ||
|
31419bfcee | ||
|
0c79e74eaa | ||
|
76eb443821 | ||
|
663eaad1b2 | ||
|
28b6a141ea | ||
|
e64d1e06b3 | ||
|
bee9037c46 | ||
|
c431b358c8 | ||
|
11174fb860 | ||
|
5a0898288d | ||
|
69e1b7c64a | ||
|
65e6297b68 | ||
|
9f22177c02 | ||
|
ef22228bda | ||
|
27c4feff66 | ||
|
9697f8c9b0 | ||
|
0801c91bc6 | ||
|
c9e3949f02 | ||
|
a8376dbe81 | ||
|
2e0c623351 | ||
|
29b202a41e | ||
|
55eceb2203 | ||
|
067d04e44e | ||
|
78c8bbde0e | ||
|
2eb2d653bf | ||
|
30afc1a2c0 | ||
|
8e07366994 | ||
|
111e775060 | ||
|
c02a347880 | ||
|
fdf4695c1e | ||
|
2a014ce0b3 | ||
|
8d280217cd | ||
|
bbc058967b | ||
|
e143832ad4 | ||
|
c6487d9472 | ||
|
f69b1db45c | ||
|
5a72344c9a | ||
|
9bfd0abb55 | ||
|
1ed681cc43 | ||
|
6de0d7a737 | ||
|
4d4f8d0d50 | ||
|
73851fb6da | ||
|
2829f3eccc | ||
|
030c1aa646 | ||
|
6270e2aebf | ||
|
5da55ba8ad | ||
|
f0ff3834bc | ||
|
8afb3a5b82 | ||
|
8c49c54987 | ||
|
ccbbf04e5b | ||
|
52ee9faa72 | ||
|
7c910499ec | ||
|
e8289dfee6 | ||
|
39dbff7204 | ||
|
a455b86bd3 | ||
|
345a86d49b | ||
|
625b24a104 | ||
|
6dcce92490 | ||
|
4732b96dba | ||
|
d95451d924 | ||
|
30f6061f48 | ||
|
cff947acd0 | ||
|
83b5b24950 | ||
|
61111b1460 | ||
|
839ccb719b | ||
|
2fcb0f48b1 | ||
|
1a500f1a74 | ||
|
e68975fcf7 | ||
|
4d34700bcc | ||
|
8c10944575 | ||
|
8cfa7152f7 | ||
|
bd652237fb | ||
|
7284d84dc8 | ||
|
57a5ed7f67 | ||
|
23afc48fc3 | ||
|
938ec0f7bf | ||
|
1065389c4e | ||
|
c19b13cdfc | ||
|
1c35cb3bc9 | ||
|
1189198a5e | ||
|
b4da9e301f | ||
|
d94db2d11d | ||
|
cd8c6c1f22 | ||
|
edd35e8f6e | ||
|
1de764ba87 | ||
|
ba1e2dad3c | ||
|
c565fd45c1 | ||
|
8622bd5f49 | ||
|
04cb022e44 | ||
|
5a2237a1e2 | ||
|
d63434493a | ||
|
722596eaae | ||
|
1860c9ad09 | ||
|
b1ee2e6e14 | ||
|
14dd5b503a | ||
|
5040a67939 | ||
|
8e664fc984 | ||
|
72c7d86276 | ||
|
4d9f6522e5 | ||
|
cf2366c949 | ||
|
e6f6d0ecf4 | ||
|
52ab3d0f22 | ||
|
aa07289c24 | ||
|
c083af972a | ||
|
c053ffeacc | ||
|
3baa3dd98b | ||
|
62220666ba | ||
|
b6c0c51cbe | ||
|
5ed9c7022b | ||
|
14903c380e | ||
|
a7d39c3e3a | ||
|
0fac0859af | ||
|
3dade5b5a5 | ||
|
7ba4124c78 | ||
|
6b698ff6bc | ||
|
88d3540b54 | ||
|
ddc89fa985 | ||
|
529de5606e | ||
|
94cb87ad30 | ||
|
460e953076 | ||
|
1947dd2f94 | ||
|
4568507507 | ||
|
be880a1fc8 | ||
|
75c4044b7e | ||
|
5544c78299 | ||
|
58f0d36e76 | ||
|
93380c02a1 | ||
|
ec93432a59 | ||
|
4e7ca2d704 | ||
|
5bb2b59db4 | ||
|
b0439d3283 | ||
|
553b0ad5d3 | ||
|
1384c68dc7 | ||
|
e0bb21f832 | ||
|
bd0f87c18b | ||
|
30e6b8a5ea | ||
|
553caa18ce | ||
|
a79752a04a | ||
|
a2712b5e38 | ||
|
5dbfd380f0 | ||
|
ac7fc396a0 | ||
|
bcf7bdaa13 | ||
|
0debe8c669 | ||
|
db5df4bfde | ||
|
de2c0c1a95 | ||
|
d95b05ea5f | ||
|
877484cd7e | ||
|
15af8e072d | ||
|
93ef558fa8 | ||
|
51437bf943 | ||
|
55094e2ddf | ||
|
d1a0202125 | ||
|
22eb827b3d | ||
|
ce41f6ec74 | ||
|
71d86f9a6e | ||
|
edce1e94b3 | ||
|
84c0047ccd | ||
|
cd5c774b2b | ||
|
c0ce725293 | ||
|
f8ef5f605b | ||
|
592bfe0e01 | ||
|
6a9f5a244a | ||
|
6a41432498 | ||
|
147f34ab5f | ||
|
a2a4485ed3 | ||
|
dabbc05a39 | ||
|
f2637bae55 | ||
|
1813a4551e | ||
|
ce88adea2a | ||
|
76f3aa5b05 | ||
|
61f35dc6b1 | ||
|
ac4313560f | ||
|
09c4c4bae9 | ||
|
cb196ddbb1 | ||
|
b3febb7416 | ||
|
92365c9784 | ||
|
96cdeaa725 | ||
|
9a2ce912ff | ||
|
8d1da77d0d | ||
|
2dfc5142f4 | ||
|
a8a17dc4b5 | ||
|
76be28cdc6 | ||
|
4ff01a7a4a | ||
|
5f2bb1b48b | ||
|
dc09a3dd51 | ||
|
ad13a1f8df | ||
|
9c649ea7d1 | ||
|
0640b2e486 | ||
|
8ede50cafd | ||
|
83083a8a13 | ||
|
ef0104e768 | ||
|
1c465a0890 | ||
|
37678b0656 | ||
|
5281427a99 | ||
|
4ef0bb676c | ||
|
a8650b99a3 | ||
|
fc7aca7ff2 | ||
|
9f4a0e308b | ||
|
7562ebc6e1 | ||
|
a936a1b156 | ||
|
b32aafe4dc | ||
|
220771565f | ||
|
4ada1d7d5e | ||
|
59ba98b2e3 | ||
|
30283b57df | ||
|
7ffc6a7465 | ||
|
631ae9e6e4 | ||
|
1b2b0904ce | ||
|
2be332ae21 | ||
|
4bfb9b2d70 | ||
|
92a4d175e6 | ||
|
abb5452a12 | ||
|
3d575b58a4 | ||
|
d442d7908a | ||
|
97d48ba94a | ||
|
317bc0c89c | ||
|
30e13dac2b | ||
|
830533d49e | ||
|
5cdb1bc4e1 | ||
|
57f9eed00d | ||
|
5a9d7c8388 | ||
|
9d2571d2ed | ||
|
a695b671aa | ||
|
96d6190b61 | ||
|
84bdb05bd2 | ||
|
ac5deb155d | ||
|
2f25cb94f5 | ||
|
2bc6188be3 | ||
|
d43062ba78 | ||
|
83861f5b1d | ||
|
15e0364968 | ||
|
c59ce22c8f | ||
|
c6ec8295e8 | ||
|
7cd201c290 | ||
|
c3ece08119 | ||
|
596292f874 | ||
|
170a291d4d | ||
|
7db0e87af1 | ||
|
26c48dec46 | ||
|
2f94b181a2 | ||
|
f13ad7789b | ||
|
f7565c2d5e | ||
|
c93d3865f7 | ||
|
53229b1537 | ||
|
288d143357 | ||
|
5fb9b50da8 | ||
|
d6bccb1f4c | ||
|
231278eded | ||
|
1aaa318f1c | ||
|
80a390cbbb | ||
|
af2904b01c | ||
|
0d9649ca45 | ||
|
b9f488a713 | ||
|
7372519cba | ||
|
cdd3678c29 | ||
|
cd87a39736 | ||
|
b1a85116bd | ||
|
bd720c316a | ||
|
bcd6dbd772 | ||
|
6f3586516a | ||
|
b5f670f826 | ||
|
05d93e0990 | ||
|
4689d8ff86 | ||
|
ee0a82be1b | ||
|
02be485e04 | ||
|
a5bf4d9a7f | ||
|
dd1b87dae9 | ||
|
20300df3c3 | ||
|
85d2cba801 | ||
|
b51a37314c | ||
|
0066c28cb2 | ||
|
225bace85c | ||
|
8d80cf697a | ||
|
da2428fbb1 | ||
|
785250de45 | ||
|
3786856b72 | ||
|
95c638b39b | ||
|
1544768719 | ||
|
b13e2698bb | ||
|
d02ab775f3 | ||
|
dbef667bf4 | ||
|
cfd4c73b5b | ||
|
a33ba8e646 | ||
|
ae3a498e43 | ||
|
83da5fc958 | ||
|
2cdd0e5e55 | ||
|
50b2d8fb66 | ||
|
b375458aab | ||
|
0d03a938cc | ||
|
71662b5b5a | ||
|
c3dc20fdb4 | ||
|
54b13568e4 | ||
|
6f6f656aa7 |
999
.github/.cSpellWords.txt
vendored
Normal file
999
.github/.cSpellWords.txt
vendored
Normal file
|
@ -0,0 +1,999 @@
|
||||||
|
AASR
|
||||||
|
ABETRG
|
||||||
|
ABSR
|
||||||
|
ABTSZ
|
||||||
|
ACCAH
|
||||||
|
ACCAL
|
||||||
|
ACCAU
|
||||||
|
ACCBH
|
||||||
|
ACCBL
|
||||||
|
ACCBU
|
||||||
|
ACLK
|
||||||
|
acpa
|
||||||
|
ACPA
|
||||||
|
acpc
|
||||||
|
ACPC
|
||||||
|
addi
|
||||||
|
addiu
|
||||||
|
ADTRG
|
||||||
|
aeevt
|
||||||
|
AEEVT
|
||||||
|
AERR
|
||||||
|
AIRCR
|
||||||
|
ALMIEN
|
||||||
|
ALMV
|
||||||
|
ANDC
|
||||||
|
andi
|
||||||
|
ANDCCR
|
||||||
|
APIC
|
||||||
|
APROCFREQ
|
||||||
|
APSR
|
||||||
|
ARMCM
|
||||||
|
Armv
|
||||||
|
ARMVFP
|
||||||
|
ASTRINGZ
|
||||||
|
aswtrg
|
||||||
|
ASWTRG
|
||||||
|
Ateml
|
||||||
|
ATMEGA
|
||||||
|
Atmel
|
||||||
|
ATMEL
|
||||||
|
atomatic
|
||||||
|
ATPASTE
|
||||||
|
AVRDX
|
||||||
|
BANDL
|
||||||
|
bcpb
|
||||||
|
BCPB
|
||||||
|
bcpc
|
||||||
|
BCPC
|
||||||
|
beevt
|
||||||
|
BEEVT
|
||||||
|
beqz
|
||||||
|
BERR
|
||||||
|
bfextu
|
||||||
|
Biagioni
|
||||||
|
bics
|
||||||
|
BISR
|
||||||
|
BODIEN
|
||||||
|
BODSTS
|
||||||
|
brealid
|
||||||
|
BRGR
|
||||||
|
brhi
|
||||||
|
brne
|
||||||
|
bswtrg
|
||||||
|
BSWTRG
|
||||||
|
Bytesto
|
||||||
|
CANEN
|
||||||
|
CANRX
|
||||||
|
CANTX
|
||||||
|
capitalisation
|
||||||
|
cbmc
|
||||||
|
CBMC
|
||||||
|
cbor
|
||||||
|
CBOR
|
||||||
|
CCIE
|
||||||
|
CCMP
|
||||||
|
CCNT
|
||||||
|
CCNTR
|
||||||
|
CCPN
|
||||||
|
CCPR
|
||||||
|
CCRH
|
||||||
|
CDTY
|
||||||
|
CDTYR
|
||||||
|
CFBS
|
||||||
|
CFRC
|
||||||
|
CHDIV
|
||||||
|
CHDR
|
||||||
|
CHRL
|
||||||
|
CHSR
|
||||||
|
CICR
|
||||||
|
CISR
|
||||||
|
CKDIV
|
||||||
|
CKDIVMD
|
||||||
|
CKEY
|
||||||
|
CKGR
|
||||||
|
CKLO
|
||||||
|
CKPS
|
||||||
|
CLDIV
|
||||||
|
CLEARINTENA
|
||||||
|
CLKA
|
||||||
|
CLKB
|
||||||
|
CLKDIS
|
||||||
|
CLKEN
|
||||||
|
clki
|
||||||
|
CLKI
|
||||||
|
CLKP
|
||||||
|
CLKS
|
||||||
|
CLKSOURCE
|
||||||
|
CLKSTA
|
||||||
|
CLRB
|
||||||
|
CLRF
|
||||||
|
clrm
|
||||||
|
CLRPSW
|
||||||
|
CMCNT
|
||||||
|
CMCON
|
||||||
|
CMCOR
|
||||||
|
CMCR
|
||||||
|
CMIE
|
||||||
|
cmock
|
||||||
|
Cmock
|
||||||
|
CMock
|
||||||
|
CMOCK
|
||||||
|
cmpx
|
||||||
|
CMSIS
|
||||||
|
CMSTR
|
||||||
|
CNTE
|
||||||
|
coalescences
|
||||||
|
CODAN
|
||||||
|
codecov
|
||||||
|
CODR
|
||||||
|
comms
|
||||||
|
COMPA
|
||||||
|
CONFG
|
||||||
|
coreid
|
||||||
|
coremqtt
|
||||||
|
CORTUS
|
||||||
|
coverity
|
||||||
|
Coverity
|
||||||
|
covfs
|
||||||
|
COVFS
|
||||||
|
CPACR
|
||||||
|
cpas
|
||||||
|
CPAS
|
||||||
|
cpbs
|
||||||
|
CPBS
|
||||||
|
cpcdis
|
||||||
|
CPCDIS
|
||||||
|
CPCS
|
||||||
|
cpcstop
|
||||||
|
CPCSTOP
|
||||||
|
CPCTRG
|
||||||
|
CPIV
|
||||||
|
CPRD
|
||||||
|
CPRDR
|
||||||
|
CPRE
|
||||||
|
cpsid
|
||||||
|
cpsie
|
||||||
|
CPSR
|
||||||
|
CPUCLK
|
||||||
|
CPUID
|
||||||
|
CRCB
|
||||||
|
crflash
|
||||||
|
CRGFLG
|
||||||
|
CRGINT
|
||||||
|
crhook
|
||||||
|
croutine
|
||||||
|
CRTV
|
||||||
|
CSAAT
|
||||||
|
CSDK
|
||||||
|
csrr
|
||||||
|
csrs
|
||||||
|
csrw
|
||||||
|
CTCR
|
||||||
|
ctest
|
||||||
|
CTPC
|
||||||
|
CTPSW
|
||||||
|
CTRLA
|
||||||
|
CTSIC
|
||||||
|
CUPD
|
||||||
|
CUPDR
|
||||||
|
CWGR
|
||||||
|
cxsf
|
||||||
|
CYGNAL
|
||||||
|
DADR
|
||||||
|
daif
|
||||||
|
DAIFCLR
|
||||||
|
DAIFSET
|
||||||
|
DATAR
|
||||||
|
DATAW
|
||||||
|
DATNB
|
||||||
|
DATRDY
|
||||||
|
DBGU
|
||||||
|
DCDIC
|
||||||
|
DCMOCK
|
||||||
|
DCMR
|
||||||
|
Dconfig
|
||||||
|
DCOUNT
|
||||||
|
decf
|
||||||
|
decfsz
|
||||||
|
decihours
|
||||||
|
Decihours
|
||||||
|
DECIHOURS
|
||||||
|
DECNT
|
||||||
|
DFPU
|
||||||
|
DFREERTOS
|
||||||
|
dicr
|
||||||
|
DICR
|
||||||
|
DIVB
|
||||||
|
DLYBCS
|
||||||
|
DLYBCT
|
||||||
|
DLYBS
|
||||||
|
DLYI
|
||||||
|
DNDEBUG
|
||||||
|
DOCOUNT
|
||||||
|
DOENDH
|
||||||
|
DOENDL
|
||||||
|
DOHIGH
|
||||||
|
DOLOW
|
||||||
|
DOSTARTH
|
||||||
|
DOSTARTL
|
||||||
|
DPFPU
|
||||||
|
DPLB
|
||||||
|
DPOPM
|
||||||
|
DPSW
|
||||||
|
DPUSHM
|
||||||
|
DRDY
|
||||||
|
DRFCS
|
||||||
|
DRPT
|
||||||
|
DRXD
|
||||||
|
DSLPE
|
||||||
|
DSNACK
|
||||||
|
DSPIC
|
||||||
|
DSRIC
|
||||||
|
DSWPAG
|
||||||
|
DTGLE
|
||||||
|
DTREN
|
||||||
|
DTXD
|
||||||
|
DUNITY
|
||||||
|
DVAR
|
||||||
|
Dxxx
|
||||||
|
EABI
|
||||||
|
ecall
|
||||||
|
ECIT
|
||||||
|
ECRS
|
||||||
|
ECRSDV
|
||||||
|
eevt
|
||||||
|
EEVT
|
||||||
|
eevtedg
|
||||||
|
EEVTEDG
|
||||||
|
EFRHD
|
||||||
|
EIIC
|
||||||
|
EINT
|
||||||
|
EIPC
|
||||||
|
EIPSW
|
||||||
|
Elektronika
|
||||||
|
EMACB
|
||||||
|
EMDC
|
||||||
|
EMDIO
|
||||||
|
emption
|
||||||
|
endm
|
||||||
|
ENDRX
|
||||||
|
ENDTX
|
||||||
|
enetrg
|
||||||
|
ENETRG
|
||||||
|
ENMFILE
|
||||||
|
EOICR
|
||||||
|
epage
|
||||||
|
EPEDS
|
||||||
|
EPINT
|
||||||
|
EPTYPE
|
||||||
|
EQIC
|
||||||
|
EQIF
|
||||||
|
EQMK
|
||||||
|
EREFCK
|
||||||
|
eret
|
||||||
|
ERRA
|
||||||
|
ERSTL
|
||||||
|
ERXCK
|
||||||
|
ERXDV
|
||||||
|
ERXER
|
||||||
|
Espeche
|
||||||
|
Espressif
|
||||||
|
ESTATUS
|
||||||
|
ETRCS
|
||||||
|
ETRGEDG
|
||||||
|
etrgs
|
||||||
|
ETRGS
|
||||||
|
ETXCK
|
||||||
|
ETXEN
|
||||||
|
ETXER
|
||||||
|
evba
|
||||||
|
EVBA
|
||||||
|
EWARM
|
||||||
|
EWAVR
|
||||||
|
EWRL
|
||||||
|
EWRX
|
||||||
|
EXID
|
||||||
|
expandnl
|
||||||
|
EXTRSM
|
||||||
|
FADD
|
||||||
|
FCMD
|
||||||
|
fcolor
|
||||||
|
FCSE
|
||||||
|
fcsr
|
||||||
|
fdiagnostics
|
||||||
|
fdiv
|
||||||
|
FDIV
|
||||||
|
FEDPICC
|
||||||
|
FERR
|
||||||
|
FFDR
|
||||||
|
FFER
|
||||||
|
FFSR
|
||||||
|
FIDI
|
||||||
|
FLASH
|
||||||
|
Flsh
|
||||||
|
FLSH
|
||||||
|
FMCN
|
||||||
|
FMRXNE
|
||||||
|
FMXR
|
||||||
|
fninit
|
||||||
|
fnsave
|
||||||
|
FNTR
|
||||||
|
FOSC
|
||||||
|
FPCCR
|
||||||
|
FPCSR
|
||||||
|
FPEPC
|
||||||
|
FPSW
|
||||||
|
FPUL
|
||||||
|
FRDY
|
||||||
|
Frieder
|
||||||
|
FSDEN
|
||||||
|
FSEDGE
|
||||||
|
FSLEN
|
||||||
|
FSOS
|
||||||
|
FSR
|
||||||
|
fwait
|
||||||
|
GCACC
|
||||||
|
GCTRL
|
||||||
|
getpacketid
|
||||||
|
getvect
|
||||||
|
GIEH
|
||||||
|
GIEL
|
||||||
|
GIRQ
|
||||||
|
GLBSTATE
|
||||||
|
GMSK
|
||||||
|
GNURX
|
||||||
|
GOVRE
|
||||||
|
gpio
|
||||||
|
GPIO
|
||||||
|
GPNVM
|
||||||
|
GPTA
|
||||||
|
HCLK
|
||||||
|
Hitach
|
||||||
|
HRESP
|
||||||
|
HTCFG
|
||||||
|
HWHSH
|
||||||
|
HWORD
|
||||||
|
HWRD
|
||||||
|
IADR
|
||||||
|
IADRSZ
|
||||||
|
ICCAVR
|
||||||
|
ICCBPR
|
||||||
|
ICCEOIR
|
||||||
|
ICCIAR
|
||||||
|
ICCICAR
|
||||||
|
ICCPMR
|
||||||
|
ICCR
|
||||||
|
ICCRPR
|
||||||
|
ICCRX
|
||||||
|
ICERST
|
||||||
|
ICIPI
|
||||||
|
ICSR
|
||||||
|
IDCR
|
||||||
|
IECR
|
||||||
|
IFDR
|
||||||
|
IFER
|
||||||
|
IFLASH
|
||||||
|
IFSR
|
||||||
|
imajeff
|
||||||
|
INACK
|
||||||
|
INDF
|
||||||
|
inpw
|
||||||
|
INTE
|
||||||
|
INTFRCH
|
||||||
|
INTFRCL
|
||||||
|
INTIT
|
||||||
|
INTTM
|
||||||
|
IODEFINE
|
||||||
|
IORLW
|
||||||
|
IPEN
|
||||||
|
IPIR
|
||||||
|
IPLB
|
||||||
|
ipsr
|
||||||
|
IPSR
|
||||||
|
iret
|
||||||
|
IRET
|
||||||
|
IRXFCS
|
||||||
|
ISRAM
|
||||||
|
ISRR
|
||||||
|
ISRS
|
||||||
|
ISR's
|
||||||
|
ISRTICK
|
||||||
|
isystem
|
||||||
|
ITIF
|
||||||
|
ITMC
|
||||||
|
ITMK
|
||||||
|
ittt
|
||||||
|
JFRAME
|
||||||
|
JTAG
|
||||||
|
JTVIC
|
||||||
|
Kamil
|
||||||
|
kbhit
|
||||||
|
Kbyte
|
||||||
|
Krutmann
|
||||||
|
LAPIC
|
||||||
|
LCDR
|
||||||
|
LCOL
|
||||||
|
lcov
|
||||||
|
ldaa
|
||||||
|
LDATA
|
||||||
|
LDBDIS
|
||||||
|
LDBSTOP
|
||||||
|
ldmdb
|
||||||
|
LDMFD
|
||||||
|
ldmia
|
||||||
|
LDRA
|
||||||
|
ldras
|
||||||
|
LDRAS
|
||||||
|
ldrb
|
||||||
|
ldrbs
|
||||||
|
LDRBS
|
||||||
|
LDRNE
|
||||||
|
ldsr
|
||||||
|
lidt
|
||||||
|
LINKR
|
||||||
|
LJMP
|
||||||
|
LLIO
|
||||||
|
lovrs
|
||||||
|
LOVRS
|
||||||
|
lpcount
|
||||||
|
lpend
|
||||||
|
lpstart
|
||||||
|
LPTHREAD
|
||||||
|
lsls
|
||||||
|
LSPEN
|
||||||
|
LSPENS
|
||||||
|
ltorg
|
||||||
|
LWRD
|
||||||
|
MABT
|
||||||
|
MACL
|
||||||
|
MAINF
|
||||||
|
MAINRDY
|
||||||
|
MAIR
|
||||||
|
Mang
|
||||||
|
Mbits
|
||||||
|
mbranch
|
||||||
|
mcause
|
||||||
|
MCFR
|
||||||
|
MCKA
|
||||||
|
MCKB
|
||||||
|
MCKR
|
||||||
|
MCKRDY
|
||||||
|
MCLK
|
||||||
|
MCU
|
||||||
|
MDDR
|
||||||
|
MDER
|
||||||
|
MDIO
|
||||||
|
MDLC
|
||||||
|
MDSR
|
||||||
|
mepc
|
||||||
|
mevents
|
||||||
|
MFCR
|
||||||
|
mfear
|
||||||
|
mfedr
|
||||||
|
mfesr
|
||||||
|
mffsr
|
||||||
|
mfgpr
|
||||||
|
mfhi
|
||||||
|
MFID
|
||||||
|
mflo
|
||||||
|
mfloat
|
||||||
|
mfmsr
|
||||||
|
mfpu
|
||||||
|
mhartid
|
||||||
|
MIDE
|
||||||
|
Mikro
|
||||||
|
MIKROC
|
||||||
|
misra
|
||||||
|
Misra
|
||||||
|
MISRA
|
||||||
|
MMCR
|
||||||
|
MMSYSERR
|
||||||
|
MOSC
|
||||||
|
MOSCS
|
||||||
|
MOSI
|
||||||
|
movem
|
||||||
|
moveq
|
||||||
|
MOVF
|
||||||
|
MOVFF
|
||||||
|
movhi
|
||||||
|
movia
|
||||||
|
movlb
|
||||||
|
movlw
|
||||||
|
movne
|
||||||
|
movs
|
||||||
|
movw
|
||||||
|
MOVWF
|
||||||
|
movx
|
||||||
|
MPLAB
|
||||||
|
MPUCTRL
|
||||||
|
MQTT
|
||||||
|
MRDY
|
||||||
|
MREAD
|
||||||
|
mret
|
||||||
|
mrseq
|
||||||
|
mrsne
|
||||||
|
MRTR
|
||||||
|
MSBF
|
||||||
|
MSDIS
|
||||||
|
MSEN
|
||||||
|
mspgcc
|
||||||
|
msreq
|
||||||
|
mstatus
|
||||||
|
MSTATUS
|
||||||
|
MSTP
|
||||||
|
MSTPA
|
||||||
|
MSTPCR
|
||||||
|
MSTPCRA
|
||||||
|
MSTPCRC
|
||||||
|
MSTR
|
||||||
|
MTCR
|
||||||
|
mthi
|
||||||
|
MTIOA
|
||||||
|
MTIOB
|
||||||
|
mtlo
|
||||||
|
mtsr
|
||||||
|
MVFACGU
|
||||||
|
MVFACHI
|
||||||
|
MVFACLO
|
||||||
|
MVFACMI
|
||||||
|
MVFC
|
||||||
|
MVTACGU
|
||||||
|
MVTACHI
|
||||||
|
MVTACLO
|
||||||
|
MVTC
|
||||||
|
MVTIPL
|
||||||
|
mypy
|
||||||
|
NCFGR
|
||||||
|
NCPHA
|
||||||
|
NEBP
|
||||||
|
NFIQ
|
||||||
|
Nios
|
||||||
|
NIOSII
|
||||||
|
NIRQ
|
||||||
|
NOGIC
|
||||||
|
noheap
|
||||||
|
nondet
|
||||||
|
Nondet
|
||||||
|
NONDET
|
||||||
|
nostdint
|
||||||
|
NPCS
|
||||||
|
NRSTL
|
||||||
|
NSACR
|
||||||
|
NSFPU
|
||||||
|
NSSR
|
||||||
|
NTRST
|
||||||
|
NVIC
|
||||||
|
ODAT
|
||||||
|
ODSR
|
||||||
|
OINC
|
||||||
|
OIWBNOWA
|
||||||
|
OIWBWA
|
||||||
|
OIWTNOWA
|
||||||
|
OPMOD
|
||||||
|
optimisations
|
||||||
|
OPTIMISED
|
||||||
|
optimiser
|
||||||
|
ORCCR
|
||||||
|
orrs
|
||||||
|
OSCBYPASS
|
||||||
|
OSCEN
|
||||||
|
OSCOFF
|
||||||
|
OSCOUNT
|
||||||
|
OSMC
|
||||||
|
OSTM
|
||||||
|
outpw
|
||||||
|
OVLY
|
||||||
|
OVRE
|
||||||
|
OVRES
|
||||||
|
OVRUN
|
||||||
|
OWATCOM
|
||||||
|
OWDR
|
||||||
|
OWER
|
||||||
|
OWSR
|
||||||
|
pacbti
|
||||||
|
PACBTI
|
||||||
|
PAGEN
|
||||||
|
PCDR
|
||||||
|
PCER
|
||||||
|
PCKR
|
||||||
|
PCLATH
|
||||||
|
PCLATU
|
||||||
|
PCLK
|
||||||
|
PCLKSEL
|
||||||
|
PCSR
|
||||||
|
PCXI
|
||||||
|
PDSR
|
||||||
|
PEID
|
||||||
|
PEIE
|
||||||
|
PENDSV
|
||||||
|
PENDSVCLEAR
|
||||||
|
PENDSVSET
|
||||||
|
PENSVCLEAR
|
||||||
|
PERIODH
|
||||||
|
PERIODL
|
||||||
|
periph
|
||||||
|
PERIPH
|
||||||
|
PFRE
|
||||||
|
phelter
|
||||||
|
PHYA
|
||||||
|
PICNT
|
||||||
|
pico
|
||||||
|
picolibc
|
||||||
|
Picolibc
|
||||||
|
PICOLIBC
|
||||||
|
PIEN
|
||||||
|
PIIR
|
||||||
|
PIMR
|
||||||
|
PIOA
|
||||||
|
PIOB
|
||||||
|
PISR
|
||||||
|
PITC
|
||||||
|
PITEN
|
||||||
|
PITIEN
|
||||||
|
PIVR
|
||||||
|
PLLB
|
||||||
|
PLLR
|
||||||
|
popa
|
||||||
|
popm
|
||||||
|
POPNE
|
||||||
|
POPW
|
||||||
|
popx
|
||||||
|
portcomn
|
||||||
|
PORTEN
|
||||||
|
portex
|
||||||
|
portisr
|
||||||
|
POWERUP
|
||||||
|
ppuc
|
||||||
|
PPUDR
|
||||||
|
PPUER
|
||||||
|
PPUSR
|
||||||
|
ppux
|
||||||
|
PRCR
|
||||||
|
PREA
|
||||||
|
PREB
|
||||||
|
PRIA
|
||||||
|
Prioritised
|
||||||
|
PRIS
|
||||||
|
PRIVDEFENA
|
||||||
|
PROCDLY
|
||||||
|
PRODH
|
||||||
|
PRODL
|
||||||
|
PROGE
|
||||||
|
Prokic
|
||||||
|
prtmacro
|
||||||
|
psha
|
||||||
|
psplim
|
||||||
|
PSPLIM
|
||||||
|
PSTDBY
|
||||||
|
PSVPAG
|
||||||
|
PTCR
|
||||||
|
PTSR
|
||||||
|
Pulpino
|
||||||
|
PUON
|
||||||
|
pusha
|
||||||
|
pushf
|
||||||
|
pushm
|
||||||
|
PUSHNE
|
||||||
|
PUSHW
|
||||||
|
pushx
|
||||||
|
PWMC
|
||||||
|
pylint
|
||||||
|
pytest
|
||||||
|
pyyaml
|
||||||
|
RAMPZ
|
||||||
|
randomisation
|
||||||
|
RASR
|
||||||
|
Rationalised
|
||||||
|
Raynald
|
||||||
|
RBAR
|
||||||
|
RBOF
|
||||||
|
RBQP
|
||||||
|
RBSY
|
||||||
|
RCALL
|
||||||
|
RCAP
|
||||||
|
RCIF
|
||||||
|
RCMR
|
||||||
|
RCOMP
|
||||||
|
RCOUNT
|
||||||
|
rddsp
|
||||||
|
RDRF
|
||||||
|
reent
|
||||||
|
REENT
|
||||||
|
REGA
|
||||||
|
RELD
|
||||||
|
Renesas
|
||||||
|
reta
|
||||||
|
reti
|
||||||
|
RETP
|
||||||
|
RETTO
|
||||||
|
RFEIA
|
||||||
|
RFMR
|
||||||
|
RIIC
|
||||||
|
RIPL
|
||||||
|
riscv
|
||||||
|
RLAR
|
||||||
|
RLCE
|
||||||
|
RLES
|
||||||
|
RLEX
|
||||||
|
RMII
|
||||||
|
RMWUPE
|
||||||
|
RNCR
|
||||||
|
RNPR
|
||||||
|
ROUSSET
|
||||||
|
ROVR
|
||||||
|
RSHR
|
||||||
|
rslcx
|
||||||
|
RSLCX
|
||||||
|
RSMINPR
|
||||||
|
RSTC
|
||||||
|
RSTEP
|
||||||
|
RSTIT
|
||||||
|
RSTNACK
|
||||||
|
RSTRX
|
||||||
|
RSTSTA
|
||||||
|
RSTTX
|
||||||
|
Rsvd
|
||||||
|
RTAR
|
||||||
|
RTCEN
|
||||||
|
RTCSC
|
||||||
|
RTICTL
|
||||||
|
RTIE
|
||||||
|
RTIF
|
||||||
|
RTIFRC
|
||||||
|
RTMR
|
||||||
|
RTOR
|
||||||
|
RTSEN
|
||||||
|
RTSR
|
||||||
|
RTTC
|
||||||
|
RTVR
|
||||||
|
RVDS
|
||||||
|
RXBRK
|
||||||
|
RXBUFF
|
||||||
|
RXBYTECNT
|
||||||
|
RXDIS
|
||||||
|
Rxed
|
||||||
|
RXEN
|
||||||
|
RXENA
|
||||||
|
RXOVERWRITE
|
||||||
|
RXRDY
|
||||||
|
RXRSM
|
||||||
|
RXSETUP
|
||||||
|
RXSUSP
|
||||||
|
RXSYN
|
||||||
|
RXTDIS
|
||||||
|
RXTEN
|
||||||
|
RXUBR
|
||||||
|
SBYCR
|
||||||
|
SCALL
|
||||||
|
SCBR
|
||||||
|
SCDR
|
||||||
|
SCER
|
||||||
|
SCSR
|
||||||
|
SDCC
|
||||||
|
SECU
|
||||||
|
SENDA
|
||||||
|
SETB
|
||||||
|
SETEN
|
||||||
|
SETINTENA
|
||||||
|
SETPSW
|
||||||
|
SETR
|
||||||
|
setvect
|
||||||
|
SFRC
|
||||||
|
SHLL
|
||||||
|
SHLR
|
||||||
|
SHPR
|
||||||
|
SHTIM
|
||||||
|
SIFIVE
|
||||||
|
sinclude
|
||||||
|
slli
|
||||||
|
SODR
|
||||||
|
SOFTIRQ
|
||||||
|
SPCK
|
||||||
|
SPIEN
|
||||||
|
SPSR
|
||||||
|
SRCMP
|
||||||
|
SREG
|
||||||
|
SRSDB
|
||||||
|
SSBY
|
||||||
|
SSIR
|
||||||
|
SSKEY
|
||||||
|
staa
|
||||||
|
Stellaris
|
||||||
|
STILM
|
||||||
|
STKPTR
|
||||||
|
stmdb
|
||||||
|
stmia
|
||||||
|
stsr
|
||||||
|
STTBRK
|
||||||
|
STTDLY
|
||||||
|
STTOUT
|
||||||
|
STTTO
|
||||||
|
SVACC
|
||||||
|
svcne
|
||||||
|
SVDIS
|
||||||
|
svlcx
|
||||||
|
SVMST
|
||||||
|
SWAPW
|
||||||
|
SWHSH
|
||||||
|
SWINR
|
||||||
|
SWINT
|
||||||
|
SWINTR
|
||||||
|
SWRST
|
||||||
|
SWTRG
|
||||||
|
synchronise
|
||||||
|
SYNCM
|
||||||
|
syncm
|
||||||
|
SYSC
|
||||||
|
sysclk
|
||||||
|
Sysclk
|
||||||
|
SysClk
|
||||||
|
SYSClk
|
||||||
|
SYSCLK
|
||||||
|
sysclock
|
||||||
|
Sysclock
|
||||||
|
SysClock
|
||||||
|
SYSCLOCK
|
||||||
|
TACCR
|
||||||
|
TACCTL
|
||||||
|
TACLR
|
||||||
|
TACTL
|
||||||
|
TBCTRL
|
||||||
|
TBLPTRH
|
||||||
|
TBLPTRL
|
||||||
|
TBLPTRU
|
||||||
|
TBLPTRUH
|
||||||
|
TBLPTRUL
|
||||||
|
TBQP
|
||||||
|
TBSY
|
||||||
|
tcclks
|
||||||
|
TCCR
|
||||||
|
TCKPS
|
||||||
|
TCLK
|
||||||
|
TCMR
|
||||||
|
TCOMP
|
||||||
|
TDES
|
||||||
|
TDESMOD
|
||||||
|
TDMI
|
||||||
|
TDRE
|
||||||
|
TEOF
|
||||||
|
TFLG
|
||||||
|
TFMR
|
||||||
|
TGRA
|
||||||
|
THALT
|
||||||
|
TIAO
|
||||||
|
TICKISR
|
||||||
|
TIMFRZ
|
||||||
|
TIMSK
|
||||||
|
TIOA
|
||||||
|
TIOB
|
||||||
|
tmcsr
|
||||||
|
TMCSR
|
||||||
|
TMIF
|
||||||
|
TMKAEN
|
||||||
|
TMKAIF
|
||||||
|
TMKAMK
|
||||||
|
TMMK
|
||||||
|
TMPR
|
||||||
|
TMRLR
|
||||||
|
TNCR
|
||||||
|
TNPR
|
||||||
|
TOSU
|
||||||
|
TOVF
|
||||||
|
TPCS
|
||||||
|
TPFR
|
||||||
|
TRAPA
|
||||||
|
TRGEN
|
||||||
|
TRGSEL
|
||||||
|
TSHR
|
||||||
|
tstfsz
|
||||||
|
TSTP
|
||||||
|
TSTR
|
||||||
|
TTGR
|
||||||
|
TUND
|
||||||
|
TUNDR
|
||||||
|
TWCK
|
||||||
|
TXBUFE
|
||||||
|
TXCOMP
|
||||||
|
TXDIS
|
||||||
|
TXEMPTY
|
||||||
|
TXEN
|
||||||
|
TXENA
|
||||||
|
TXERR
|
||||||
|
TXIE
|
||||||
|
TXIF
|
||||||
|
TXPKTRDY
|
||||||
|
TXRDY
|
||||||
|
TXSYN
|
||||||
|
TXTEN
|
||||||
|
TXUBR
|
||||||
|
TXVC
|
||||||
|
TXVDIS
|
||||||
|
UBTI
|
||||||
|
UDCP
|
||||||
|
UNACKED
|
||||||
|
uncrustify
|
||||||
|
UNDADD
|
||||||
|
unpadded
|
||||||
|
Unpadded
|
||||||
|
UNPADDED
|
||||||
|
unprotect
|
||||||
|
Unprotect
|
||||||
|
Unprotected
|
||||||
|
UNRE
|
||||||
|
UNSUB
|
||||||
|
UNSUBACK
|
||||||
|
unsubscriptions
|
||||||
|
unsuspended
|
||||||
|
UPAC
|
||||||
|
URAD
|
||||||
|
URAT
|
||||||
|
URSTEN
|
||||||
|
URSTIEN
|
||||||
|
URSTS
|
||||||
|
Usart
|
||||||
|
USART
|
||||||
|
USPRG
|
||||||
|
USRIO
|
||||||
|
utest
|
||||||
|
utilises
|
||||||
|
utilising
|
||||||
|
vcsr
|
||||||
|
VDDCORE
|
||||||
|
vect
|
||||||
|
Vect
|
||||||
|
VECT
|
||||||
|
VECTACTIVE
|
||||||
|
VECTKEY
|
||||||
|
visualisation
|
||||||
|
vldmdbeq
|
||||||
|
vldmia
|
||||||
|
vldmiaeq
|
||||||
|
vlenb
|
||||||
|
VMSRNE
|
||||||
|
vpop
|
||||||
|
VPOPNE
|
||||||
|
vpush
|
||||||
|
VPUSHNE
|
||||||
|
VRPM
|
||||||
|
Vrtc
|
||||||
|
vsetvl
|
||||||
|
vstmdbeq
|
||||||
|
vstmiaeq
|
||||||
|
VTOR
|
||||||
|
W
|
||||||
|
WAVESEL
|
||||||
|
wavsel
|
||||||
|
Wcolor
|
||||||
|
Wconversion
|
||||||
|
WDCR
|
||||||
|
WDDBGHLT
|
||||||
|
WDDIS
|
||||||
|
WDERR
|
||||||
|
WDFIEN
|
||||||
|
WDIDLEHLT
|
||||||
|
WDMR
|
||||||
|
WDRPROC
|
||||||
|
WDRSTEN
|
||||||
|
WDRSTT
|
||||||
|
WDSR
|
||||||
|
WDTC
|
||||||
|
wdtcon
|
||||||
|
WDUNF
|
||||||
|
Werror
|
||||||
|
WESTAT
|
||||||
|
Weverything
|
||||||
|
Wextra
|
||||||
|
winmm
|
||||||
|
WIZC
|
||||||
|
Wpedantic
|
||||||
|
wrdsp
|
||||||
|
WREG
|
||||||
|
Wunused
|
||||||
|
XEXC
|
||||||
|
XPAR
|
||||||
|
xparameters
|
||||||
|
XPSR
|
||||||
|
XRAM
|
||||||
|
xtal
|
||||||
|
XTENSA
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -4,7 +4,7 @@
|
||||||
# the repo. Unless a later match takes precedence,
|
# the repo. Unless a later match takes precedence,
|
||||||
# @global-owner1 and @global-owner2 will be requested for
|
# @global-owner1 and @global-owner2 will be requested for
|
||||||
# review when someone opens a pull request.
|
# review when someone opens a pull request.
|
||||||
* @FreeRTOS/pr-bar-raiser
|
* @FreeRTOS/pr-bar-raisers
|
||||||
|
|
||||||
# Order is important; the last matching pattern takes the most
|
# Order is important; the last matching pattern takes the most
|
||||||
# precedence. When someone opens a pull request that only
|
# precedence. When someone opens a pull request that only
|
||||||
|
|
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -55,7 +55,7 @@ GitHub provides additional document on [forking a repository](https://help.githu
|
||||||
|
|
||||||
|
|
||||||
## Getting your pull request merged
|
## Getting your pull request merged
|
||||||
All pull requests must be approved by our review team before it can be merged in. We appreciate your patience while pull requests are reviewed. The time it takes to review will depend on complexity and consideration of wider implications.
|
All pull requests must be approved by our review team before it can be merged in. We appreciate your patience while pull requests are reviewed. The time it takes to review will depend on complexity and consideration of wider implications. For more information on the pull request process, please see the documentation [here](pull_request_process.md).
|
||||||
|
|
||||||
|
|
||||||
## Finding contributions to work on
|
## Finding contributions to work on
|
||||||
|
|
65
.github/actions/url_verifier.sh
vendored
65
.github/actions/url_verifier.sh
vendored
|
@ -1,65 +0,0 @@
|
||||||
#!/bin/bash -
|
|
||||||
|
|
||||||
PROJECT=$1
|
|
||||||
echo "Verifying url links of: ${PROJECT}"
|
|
||||||
if [ ! -d "$PROJECT" ]
|
|
||||||
then
|
|
||||||
echo "Directory passed does not exist"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
USER_AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36"
|
|
||||||
SCRIPT_RET=0
|
|
||||||
|
|
||||||
set -o nounset # Treat unset variables as an error
|
|
||||||
|
|
||||||
declare -A dict
|
|
||||||
|
|
||||||
function test {
|
|
||||||
while IFS= read -r LINE; do
|
|
||||||
FILE=$(echo $LINE | cut -f 1 -d ':')
|
|
||||||
URL=$(echo $LINE | grep -IoE '\b(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]')
|
|
||||||
|
|
||||||
# remove trailing / if it exists curl diferenciate between links with
|
|
||||||
# and without / at the end
|
|
||||||
# URL=`echo "$URL" | sed 's,/$,,'`
|
|
||||||
dict+=(["$URL"]="$FILE ")
|
|
||||||
done < <(grep -e 'https\?://' ${PROJECT} -RIa --exclude='*.exe' --exclude-dir=.git | tr '*' ' ')
|
|
||||||
|
|
||||||
for UNIQ_URL in ${!dict[@]} # loop urls
|
|
||||||
do
|
|
||||||
CURL_RES=$(curl -si --user-agent "${USER_AGENT}" ${UNIQ_URL} 2>/dev/null| head -n 1 | cut -f 2 -d ' ')
|
|
||||||
RES=$?
|
|
||||||
|
|
||||||
echo "================================="
|
|
||||||
echo "Checking URL: ${UNIQ_URL}"
|
|
||||||
|
|
||||||
if [ "${CURL_RES}" == '' -o "${CURL_RES}" != '200' ]
|
|
||||||
then
|
|
||||||
if [ "${CURL_RES}" == '' ] # curl returned an error
|
|
||||||
then
|
|
||||||
CURL_RES=$RES
|
|
||||||
SCRIPT_RET=1
|
|
||||||
echo ERROR: Result is: "${CURL_RES}"
|
|
||||||
elif [ "${CURL_RES}" == '403' ]
|
|
||||||
then
|
|
||||||
SCRIPT_RET=1
|
|
||||||
echo ERROR: Result is: "${CURL_RES}"
|
|
||||||
else
|
|
||||||
echo WARNING: Result is: "${CURL_RES}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo SUCCESS: Result is: "${CURL_RES}"
|
|
||||||
fi
|
|
||||||
echo "================================="
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "${SCRIPT_RET}" -eq 0 ]
|
|
||||||
then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
test
|
|
3
.github/allowed_urls.txt
vendored
Normal file
3
.github/allowed_urls.txt
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
https://www.renesas.com/us/en/document/mah/rh850f1k-group-users-manual-hardware?r=1170166
|
||||||
|
https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rh850-automotive-mcus
|
||||||
|
https://www.renesas.com/us/en/software-tool/c-compiler-package-rh850-family#downloads
|
3147
.github/lexicon.txt
vendored
3147
.github/lexicon.txt
vendored
File diff suppressed because it is too large
Load diff
BIN
.github/media/pr_process.png
vendored
Normal file
BIN
.github/media/pr_process.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 179 KiB |
115
.github/pull_request_process.md
vendored
Normal file
115
.github/pull_request_process.md
vendored
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
# Pull Request Process
|
||||||
|
|
||||||
|
This document explains the stages that a Pull Request (PR) goes through when a pull request is submitted to a git repository in the FreeRTOS organization in Github. Before you start a PR, please read and familiarize yourself with [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||||
|
|
||||||
|
## ****Terminologies****
|
||||||
|
|
||||||
|
**FreeRTOS Partner Contributors**: These are selected developers and experts from community.
|
||||||
|
|
||||||
|
**FreeRTOS Team**: The FreeRTOS team consists of “AWS employees”.
|
||||||
|
|
||||||
|
**CODEOWNERS**: For all the FreeRTOS repositories, “FreeRTOS Team” and/or “FreeRTOS Partner contributors” will be CODEOWNER.
|
||||||
|
|
||||||
|
**Contributor**: The Contributor is the person who submitted the pull request.
|
||||||
|
|
||||||
|
**Assignee**: The Assignee is an AWS Employee who is responsible for identifying reviewers and managing the PR. They track the progress of pull requests and ensure that they are reviewed and merged in a timely manner.
|
||||||
|
|
||||||
|
**Reviewer**: Reviewers are responsible for reviewing pull requests and providing feedback to the contributor. Two approving reviews, one of which must be from the CODEOWNER of the reposiroty, are required for a PR to be merged.
|
||||||
|
|
||||||
|
|
||||||
|
## ****Pull Request Life-Cycle****
|
||||||
|
|
||||||
|
Once a pull request (PR) is submitted, it goes through the following stages:
|
||||||
|
|
||||||
|
1. Open
|
||||||
|
1. The PR is created.
|
||||||
|
2. All the GitHub Actions pass and the PR is ready to be reviewed.
|
||||||
|
2. Triage
|
||||||
|
1. The PR is assigned to an assignee.
|
||||||
|
2. The assignee assigns a reviewer from the FreeRTOS Team to the PR.
|
||||||
|
3. Review
|
||||||
|
1. The reviewer provides feedback and discusses open questions with the contributor, if needed.
|
||||||
|
2. If the contributor and the reviewer conclude, after discussion, that the PR will not be merged, then the PR is closed.
|
||||||
|
3. The PR contributor addresses the feedback and makes changes to the PR, if needed.
|
||||||
|
4. The reviewer approves the PR and assigns a second reviewer.
|
||||||
|
4. Second Review
|
||||||
|
1. The second reviewer reviews the PR and provides feedback, if needed.
|
||||||
|
2. The PR contributor addresses the feedback and makes changes to the PR, if needed.
|
||||||
|
3. The second reviewer approves the PR.
|
||||||
|
5. Testing
|
||||||
|
1. One of the reviewers tests the PR to ensure that it works correctly.
|
||||||
|
6. Ready to Merge
|
||||||
|
A PR becomes Ready to Merge when all the branch protection rules are satisfied. We have branch protection rules which require the following:
|
||||||
|
1. At least 2 reviews.
|
||||||
|
2. One review from the CODEOWNER of the given repository.
|
||||||
|
3. All PR checks must pass.
|
||||||
|
7. Merge
|
||||||
|
1. The PR is merged.
|
||||||
|
|
||||||
|
</br>
|
||||||
|
|
||||||
|
The status of a PR is indicated through GitHub labels added by Reviewers/Assignees. The following are the most common status indicators: Triaged, Reviewer Assigned, Concept ACK/NACK, First Code Review In Progress, First Code Review Complete, Second Code Review In Progress, Second Code Review Complete, Testing In Progress and Testing Complete.
|
||||||
|
|
||||||
|
Please note that we may decide to skip some stages depending on the type of PR. For example, a PR with a simple doc update will likely not go through all the above stages, however every PR is required to get approvals from 2 reviewers.
|
||||||
|
|
||||||
|
The pictorial representation of our PR process is shown below.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
</br>
|
||||||
|
|
||||||
|
## **Turnaround Times**
|
||||||
|
|
||||||
|
The length of time required to review a PR is unpredictable and varies from PR to PR since it depends on the complexity of the changes, availability of reviewers, and overall workload of the team. We generally attempt to resolve each PR in accordance with the timeframes below, excluding weekends and public holidays:
|
||||||
|
|
||||||
|
* Triage: < 24 hours
|
||||||
|
* Concept ACK/NACK: 1-2 weeks
|
||||||
|
* Code Review: 1-2 weeks
|
||||||
|
* Testing: 1-2 weeks
|
||||||
|
|
||||||
|
|
||||||
|
## **Addressing the changes requested by reviewers**
|
||||||
|
|
||||||
|
The author should address any review comments in 4 weeks or less. If the author is unable to address the comments in that time, we will do one of the following:
|
||||||
|
|
||||||
|
* Make the required changes ourselves and merge the pull request.
|
||||||
|
* Close the pull request.
|
||||||
|
|
||||||
|
</br>
|
||||||
|
|
||||||
|
### **Best Practices for Faster Reviews**
|
||||||
|
|
||||||
|
Here are some best practices to follow so that your PR gets reviewed quickly.
|
||||||
|
|
||||||
|
1. If you plan to contribute a new feature to FreeRTOS, please get confirmation beforehand that the FreeRTOS team and community want, and will accept, this feature. This is true especially when you plan to make large or significant changes. To get confirmation and feedback from FreeRTOS Team and community, create a post in the FreeRTOS forums.
|
||||||
|
2. Smaller is better. Small, focused PR’s are reviewed more quickly and thoroughly, are simpler to rollback, and involve less wasted effort if rejected. Avoid opening pull requests that span the whole repository.
|
||||||
|
3. Don’t mix refactoring, bug fixes and feature development into a single PR. Lets say you are developing feature-x and you come across poorly named variables or incomplete/incorrect comments. You should consider fixing those, but in a separate PR, not in the same PR as feature-x.
|
||||||
|
4. Comments matter. The code you develop will need to be maintained for a long time. Well placed comments provide context to your reviewers, maintainers and users, and also prevent them from misunderstanding the purpose of the code. However, DO NOT add comments to explain things which are obvious by just glancing at the code. [Good Read: https://stackoverflow.blog/2021/12/23/best-practices-for-writing-code-comments/]
|
||||||
|
5. Test your PR. In your PR, please accompany your changes with suitable unit tests and any other tests that will be helpful, and include descriptions of how to perform any manual tests. Instructions for unit tests can be found at [freertos.org](https://freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html#Testing) and [Github](https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS/Test/CMock/Readme.md)
|
||||||
|
|
||||||
|
|
||||||
|
**Push Back its ok:**
|
||||||
|
Sometimes reviewers make mistakes. If a reviewer has requested you to make changes and you feel strongly about doing it a certain way, you are free to debate the merits of the requested change with the reviewer, while still following the code of conduct. You might be overruled, but you might also prevail.
|
||||||
|
|
||||||
|
**Be Pragmatic**
|
||||||
|
Put a bit of thought into how your PR can be made easier to review and merge. No document can replace common sense and good taste. The best practices shared here and the contribution guidelines, if followed, will help you get your code reviewed and merged with less friction.
|
||||||
|
|
||||||
|
</br>
|
||||||
|
|
||||||
|
### **Why is my PR closed?**
|
||||||
|
|
||||||
|
Pull requests older than 120 days or not in-line with scope of the project will be closed. Exceptions can be made for pull requests that have active review comments, or that are awaiting other dependent pull requests. Closed pull requests are easy to recreate, and little work is lost by closing a pull request that is subsequently reopened. We want to limit the total number of pull requests in flight to:
|
||||||
|
|
||||||
|
* Maintain a clean project
|
||||||
|
* Remove old pull requests that would be difficult to rebase since the underlying code has changed over time
|
||||||
|
* Encourage code velocity
|
||||||
|
|
||||||
|
### **Why is my PR not getting reviewed/merged?**
|
||||||
|
|
||||||
|
* It may be because of a feature freeze due to an upcoming release. During this time, only bug fixes are taken into consideration. If your pull request is a new feature, it will not be prioritised until after the release. Wait for the release.
|
||||||
|
* It could be related to best practices (see contributing.md) not being followed. One common issue is that the pull request is too big to review. Let’s say you’ve touched 21 files and have 9347 insertions. When your would-be reviewers pull up the diffs, they run away - this pull request is going to take a few hours to review and they don’t have a few hours right now. They’ll get to it later, just as soon as they have more free time (ha!).
|
||||||
|
* If you think the above two situations are not the reason, and you are not getting some pull request love, please drop a couple of reminders on the PR comments. If everything else fails, please create a post on FreeRTOS forums with link to PR.
|
||||||
|
|
||||||
|
|
||||||
|
|
106
.github/scripts/kernel_checker.py
vendored
106
.github/scripts/kernel_checker.py
vendored
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#/*
|
#/*
|
||||||
# * FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
# * FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
# * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
# * Copyright (C) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
# *
|
# *
|
||||||
# * SPDX-License-Identifier: MIT
|
# * SPDX-License-Identifier: MIT
|
||||||
# *
|
# *
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
# */
|
# */
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
from common.header_checker import HeaderChecker
|
from common.header_checker import HeaderChecker
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------------------------
|
||||||
|
@ -36,7 +37,9 @@ from common.header_checker import HeaderChecker
|
||||||
KERNEL_IGNORED_FILES = [
|
KERNEL_IGNORED_FILES = [
|
||||||
'FreeRTOS-openocd.c',
|
'FreeRTOS-openocd.c',
|
||||||
'Makefile',
|
'Makefile',
|
||||||
'.DS_Store'
|
'.DS_Store',
|
||||||
|
'cspell.config.yaml',
|
||||||
|
'.clang-format'
|
||||||
]
|
]
|
||||||
|
|
||||||
KERNEL_IGNORED_EXTENSIONS = [
|
KERNEL_IGNORED_EXTENSIONS = [
|
||||||
|
@ -61,7 +64,8 @@ KERNEL_IGNORED_EXTENSIONS = [
|
||||||
'.bat',
|
'.bat',
|
||||||
'.sh',
|
'.sh',
|
||||||
'.txt',
|
'.txt',
|
||||||
'.cmake'
|
'.cmake',
|
||||||
|
'.config'
|
||||||
]
|
]
|
||||||
|
|
||||||
KERNEL_ASM_EXTENSIONS = [
|
KERNEL_ASM_EXTENSIONS = [
|
||||||
|
@ -87,7 +91,13 @@ KERNEL_IGNORED_PATTERNS = [
|
||||||
r'.*\.git.*',
|
r'.*\.git.*',
|
||||||
r'.*portable/IAR/AtmelSAM7S64/.*AT91SAM7.*',
|
r'.*portable/IAR/AtmelSAM7S64/.*AT91SAM7.*',
|
||||||
r'.*portable/GCC/ARM7_AT91SAM7S/.*',
|
r'.*portable/GCC/ARM7_AT91SAM7S/.*',
|
||||||
r'.*portable/MPLAB/PIC18F/stdio.h'
|
r'.*portable/MPLAB/PIC18F/stdio.h',
|
||||||
|
r'.*portable/ThirdParty/xClang/XCOREAI/*',
|
||||||
|
r'.*IAR/ARM_C*',
|
||||||
|
r'.*IAR/78K0R/*',
|
||||||
|
r'.*CCS/MSP430X/*',
|
||||||
|
r'.*portable/template/*',
|
||||||
|
r'.*template_configuration/*'
|
||||||
]
|
]
|
||||||
|
|
||||||
KERNEL_THIRD_PARTY_PATTERNS = [
|
KERNEL_THIRD_PARTY_PATTERNS = [
|
||||||
|
@ -97,6 +107,15 @@ KERNEL_THIRD_PARTY_PATTERNS = [
|
||||||
r'.*portable/GCC/AVR32_UC3/.*',
|
r'.*portable/GCC/AVR32_UC3/.*',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
KERNEL_ARM_COLLAB_FILES_PATTERNS = [
|
||||||
|
r'.*portable/ARMv8M/*',
|
||||||
|
r'.*portable/.*/ARM_CM23*',
|
||||||
|
r'.*portable/.*/ARM_CM33*',
|
||||||
|
r'.*portable/.*/ARM_CM35*',
|
||||||
|
r'.*portable/.*/ARM_CM55*',
|
||||||
|
r'.*portable/.*/ARM_CM85*',
|
||||||
|
]
|
||||||
|
|
||||||
KERNEL_HEADER = [
|
KERNEL_HEADER = [
|
||||||
'/*\n',
|
'/*\n',
|
||||||
' * FreeRTOS Kernel <DEVELOPMENT BRANCH>\n',
|
' * FreeRTOS Kernel <DEVELOPMENT BRANCH>\n',
|
||||||
|
@ -127,12 +146,89 @@ KERNEL_HEADER = [
|
||||||
' */\n',
|
' */\n',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
FREERTOS_COPYRIGHT_REGEX = r"^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(C\) 20\d\d Amazon.com, Inc. or its affiliates. All Rights Reserved\.( \*\/)?$"
|
||||||
|
|
||||||
|
FREERTOS_ARM_COLLAB_COPYRIGHT_REGEX = r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright \(C\) 20\d\d Amazon.com, Inc. or its affiliates. All Rights Reserved\.( \*\/)?$)|" + \
|
||||||
|
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? Copyright 20\d\d Arm Limited and/or its affiliates( \*\/)?$)|" + \
|
||||||
|
r"(^(;|#)?( *(\/\*|\*|#|\/\/))? <open-source-office@arm.com>( \*\/)?$)"
|
||||||
|
|
||||||
|
|
||||||
|
class KernelHeaderChecker(HeaderChecker):
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
header,
|
||||||
|
padding=1000,
|
||||||
|
ignored_files=None,
|
||||||
|
ignored_ext=None,
|
||||||
|
ignored_patterns=None,
|
||||||
|
py_ext=None,
|
||||||
|
asm_ext=None,
|
||||||
|
third_party_patterns=None,
|
||||||
|
copyright_regex = None
|
||||||
|
):
|
||||||
|
super().__init__(header, padding, ignored_files, ignored_ext, ignored_patterns,
|
||||||
|
py_ext, asm_ext, third_party_patterns, copyright_regex)
|
||||||
|
|
||||||
|
self.armCollabRegex = re.compile(FREERTOS_ARM_COLLAB_COPYRIGHT_REGEX)
|
||||||
|
|
||||||
|
self.armCollabFilesPatternList = []
|
||||||
|
for pattern in KERNEL_ARM_COLLAB_FILES_PATTERNS:
|
||||||
|
self.armCollabFilesPatternList.append(re.compile(pattern))
|
||||||
|
|
||||||
|
def isArmCollabFile(self, path):
|
||||||
|
for pattern in self.armCollabFilesPatternList:
|
||||||
|
if pattern.match(path):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def checkArmCollabFile(self, path):
|
||||||
|
isValid = False
|
||||||
|
file_ext = os.path.splitext(path)[-1]
|
||||||
|
|
||||||
|
with open(path, encoding="utf-8", errors="ignore") as file:
|
||||||
|
chunk = file.read(len("".join(self.header)) + self.padding)
|
||||||
|
lines = [("%s\n" % line) for line in chunk.strip().splitlines()][
|
||||||
|
: len(self.header) + 2
|
||||||
|
]
|
||||||
|
if (len(lines) > 0) and (lines[0].find("#!") == 0):
|
||||||
|
lines.remove(lines[0])
|
||||||
|
|
||||||
|
# Split lines in sections.
|
||||||
|
headers = dict()
|
||||||
|
headers["text"] = []
|
||||||
|
headers["copyright"] = []
|
||||||
|
headers["spdx"] = []
|
||||||
|
for line in lines:
|
||||||
|
if self.armCollabRegex.match(line):
|
||||||
|
headers["copyright"].append(line)
|
||||||
|
elif "SPDX-License-Identifier:" in line:
|
||||||
|
headers["spdx"].append(line)
|
||||||
|
else:
|
||||||
|
headers["text"].append(line)
|
||||||
|
|
||||||
|
text_equal = self.isValidHeaderSection(file_ext, "text", headers["text"])
|
||||||
|
spdx_equal = self.isValidHeaderSection(file_ext, "spdx", headers["spdx"])
|
||||||
|
|
||||||
|
if text_equal and spdx_equal and len(headers["copyright"]) == 3:
|
||||||
|
isValid = True
|
||||||
|
|
||||||
|
return isValid
|
||||||
|
|
||||||
|
def customCheck(self, path):
|
||||||
|
isValid = False
|
||||||
|
if self.isArmCollabFile(path):
|
||||||
|
isValid = self.checkArmCollabFile(path)
|
||||||
|
return isValid
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = HeaderChecker.configArgParser()
|
parser = HeaderChecker.configArgParser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Configure the checks then run
|
# Configure the checks then run
|
||||||
checker = HeaderChecker(KERNEL_HEADER,
|
checker = KernelHeaderChecker(KERNEL_HEADER,
|
||||||
|
copyright_regex=FREERTOS_COPYRIGHT_REGEX,
|
||||||
ignored_files=KERNEL_IGNORED_FILES,
|
ignored_files=KERNEL_IGNORED_FILES,
|
||||||
ignored_ext=KERNEL_IGNORED_EXTENSIONS,
|
ignored_ext=KERNEL_IGNORED_EXTENSIONS,
|
||||||
ignored_patterns=KERNEL_IGNORED_PATTERNS,
|
ignored_patterns=KERNEL_IGNORED_PATTERNS,
|
||||||
|
|
32
.github/scripts/manifest_updater.py
vendored
Executable file
32
.github/scripts/manifest_updater.py
vendored
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
THIS_FILE_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
MANIFEST_FILE = os.path.join(THIS_FILE_PATH, '..', '..', 'manifest.yml')
|
||||||
|
|
||||||
|
def update_manifest_file(new_version_number):
|
||||||
|
updated_lines = []
|
||||||
|
with open(MANIFEST_FILE, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith('version'):
|
||||||
|
updated_lines.append(f'version: "V{new_version_number}"\n')
|
||||||
|
else:
|
||||||
|
updated_lines.append(f'{line}\n')
|
||||||
|
|
||||||
|
with open(MANIFEST_FILE, 'w') as f:
|
||||||
|
f.writelines(updated_lines)
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('-v', '--version', required=True, help='New version number.')
|
||||||
|
args = parser.parse_args()
|
||||||
|
return args
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = parse_args()
|
||||||
|
update_manifest_file(args.version)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
14
.github/third_party_tools.md
vendored
Normal file
14
.github/third_party_tools.md
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Note that these tools are provided by different vendors and not by the FreeRTOS
|
||||||
|
team.
|
||||||
|
|
||||||
|
## Tracing Tools
|
||||||
|
| Tool | Website | Getting Started |
|
||||||
|
|------|---------|-----------------|
|
||||||
|
| Tracelyzer | [Link](https://percepio.com/tracealyzer/freertostrace/) | [Link](https://percepio.com/getstarted/latest/html/freertos.html) |
|
||||||
|
| SystemView | [Link](https://www.segger.com/products/development-tools/systemview/) | [Link](https://wiki.segger.com/FreeRTOS_with_SystemView) |
|
||||||
|
|
||||||
|
## Static Code Analysis Tools
|
||||||
|
| Tool | Website | Getting Started |
|
||||||
|
|------|---------|-----------------|
|
||||||
|
| Code Sonar | [Link](https://codesecure.com/our-products/codesonar/) | [Link](https://github.com/CodeSecure-SE/FreeRTOS-Kernel/blob/main/examples/codesonar/README.md) |
|
||||||
|
| Coverity | [Link](https://www.blackduck.com/static-analysis-tools-sast/coverity.html) | [Link](../examples/coverity/README.md) |
|
59
.github/workflows/auto-release.yml
vendored
59
.github/workflows/auto-release.yml
vendored
|
@ -31,37 +31,62 @@ jobs:
|
||||||
|
|
||||||
# Currently FreeRTOS/.github/scripts houses the release script. Download it for upcoming usage
|
# Currently FreeRTOS/.github/scripts houses the release script. Download it for upcoming usage
|
||||||
- name: Checkout FreeRTOS Release Tools
|
- name: Checkout FreeRTOS Release Tools
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
repository: FreeRTOS/FreeRTOS
|
repository: FreeRTOS/FreeRTOS
|
||||||
path: tools
|
path: tools
|
||||||
|
|
||||||
# Simpler git auth if we use checkout action and forward the repo to release script
|
# Simpler git auth if we use checkout action and forward the repo to release script
|
||||||
- name: Checkout FreeRTOS Kernel
|
- name: Checkout FreeRTOS Kernel
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
path: local_kernel
|
path: local_kernel
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Configure git identity
|
- name: Configure git identity
|
||||||
|
env:
|
||||||
|
ACTOR: ${{ github.actor }}
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name ${{ github.actor }}
|
git config --global user.name "$ACTOR"
|
||||||
git config --global user.email ${{ github.actor }}@users.noreply.github.com
|
git config --global user.email "$ACTOR"@users.noreply.github.com
|
||||||
|
|
||||||
- name: create a new branch that references commit id
|
- name: create a new branch that references commit id
|
||||||
|
env:
|
||||||
|
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
|
||||||
|
COMMIT_ID: ${{ github.event.inputs.commit_id }}
|
||||||
working-directory: ./local_kernel
|
working-directory: ./local_kernel
|
||||||
run: |
|
run: |
|
||||||
git checkout -b ${{ github.event.inputs.version_number }} ${{ github.event.inputs.commit_id }}
|
git checkout -b "$VERSION_NUMBER" "$COMMIT_ID"
|
||||||
echo "COMMIT_SHA_1=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
echo "COMMIT_SHA_1=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Update source files with version info
|
- name: Update source files with version info
|
||||||
|
env:
|
||||||
|
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
|
||||||
|
MAIN_BR_VERSION_NUMBER: ${{ github.event.inputs.main_br_version }}
|
||||||
|
COMMIT_SHA_1: ${{ env.COMMIT_SHA_1 }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
# Install deps and run
|
# Install deps and run
|
||||||
pip install -r ./tools/.github/scripts/release-requirements.txt
|
pip install -r ./tools/.github/scripts/release-requirements.txt
|
||||||
./tools/.github/scripts/update_src_version.py FreeRTOS --kernel-repo-path=local_kernel --kernel-commit=${{ env.COMMIT_SHA_1 }} --new-kernel-version=${{ github.event.inputs.version_number }} --new-kernel-main-br-version=${{ github.event.inputs.main_br_version }}
|
./tools/.github/scripts/update_src_version.py FreeRTOS --kernel-repo-path=local_kernel --kernel-commit="$COMMIT_SHA_1" --new-kernel-version="$VERSION_NUMBER" --new-kernel-main-br-version="$MAIN_BR_VERSION_NUMBER"
|
||||||
exit $?
|
exit $?
|
||||||
|
|
||||||
|
- name : Update version number in manifest.yml
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
|
||||||
|
working-directory: ./local_kernel
|
||||||
|
run: |
|
||||||
|
./.github/scripts/manifest_updater.py -v "$VERSION_NUMBER"
|
||||||
|
exit $?
|
||||||
|
|
||||||
|
- name : Commit version number change in manifest.yml
|
||||||
|
env:
|
||||||
|
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
|
||||||
|
working-directory: ./local_kernel
|
||||||
|
run: |
|
||||||
|
git add .
|
||||||
|
git commit -m '[AUTO][RELEASE]: Update version number in manifest.yml'
|
||||||
|
git push -u origin "$VERSION_NUMBER"
|
||||||
|
|
||||||
- name: Generate SBOM
|
- name: Generate SBOM
|
||||||
uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main
|
uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main
|
||||||
|
@ -70,24 +95,32 @@ jobs:
|
||||||
source_path: ./
|
source_path: ./
|
||||||
|
|
||||||
- name: commit SBOM file
|
- name: commit SBOM file
|
||||||
|
env:
|
||||||
|
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
|
||||||
working-directory: ./local_kernel
|
working-directory: ./local_kernel
|
||||||
run: |
|
run: |
|
||||||
git add .
|
git add .
|
||||||
git commit -m 'Update SBOM'
|
git commit -m '[AUTO][RELEASE]: Update SBOM'
|
||||||
git push -u origin ${{ github.event.inputs.version_number }}
|
git push -u origin "$VERSION_NUMBER"
|
||||||
echo "COMMIT_SHA_2=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
echo "COMMIT_SHA_2=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
|
env:
|
||||||
|
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
|
||||||
|
MAIN_BR_VERSION_NUMBER: ${{ github.event.inputs.main_br_version }}
|
||||||
|
COMMIT_SHA_2: ${{ env.COMMIT_SHA_2 }}
|
||||||
|
REPO_OWNER: ${{ github.repository_owner }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
# Install deps and run
|
# Install deps and run
|
||||||
pip install -r ./tools/.github/scripts/release-requirements.txt
|
pip install -r ./tools/.github/scripts/release-requirements.txt
|
||||||
./tools/.github/scripts/release.py FreeRTOS --kernel-repo-path=local_kernel --kernel-commit=${{ env.COMMIT_SHA_2 }} --new-kernel-version=${{ github.event.inputs.version_number }} --new-kernel-main-br-version=${{ github.event.inputs.main_br_version }}
|
./tools/.github/scripts/release.py "$REPO_OWNER" --kernel-repo-path=local_kernel --kernel-commit="$COMMIT_SHA_2" --new-kernel-version="$VERSION_NUMBER" --new-kernel-main-br-version="$MAIN_BR_VERSION_NUMBER"
|
||||||
exit $?
|
exit $?
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
|
env:
|
||||||
|
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
|
||||||
working-directory: ./local_kernel
|
working-directory: ./local_kernel
|
||||||
run: |
|
run: |
|
||||||
# Delete the branch created for Tag by SBOM generator
|
# Delete the branch created for Tag by SBOM generator
|
||||||
git push -u origin --delete ${{ github.event.inputs.version_number }}
|
git push -u origin --delete "$VERSION_NUMBER"
|
||||||
|
|
99
.github/workflows/ci.yml
vendored
99
.github/workflows/ci.yml
vendored
|
@ -6,75 +6,46 @@ on:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
jobs:
|
jobs:
|
||||||
spell-check:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Parent Repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
ref: main
|
|
||||||
repository: aws/aws-iot-device-sdk-embedded-C
|
|
||||||
path: main
|
|
||||||
- name: Clone This Repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
path: ./kernel
|
|
||||||
- name: Install spell
|
|
||||||
run: |
|
|
||||||
sudo apt-get install spell
|
|
||||||
sudo apt-get install util-linux
|
|
||||||
- name: Check spelling
|
|
||||||
run: |
|
|
||||||
PATH=$PATH:main/tools/spell
|
|
||||||
# Make sure that the portable directory is not included in the spellcheck.
|
|
||||||
sed -i 's/find $DIRNAME/find $DIRNAME -not -path '*portable*'/g' main/tools/spell/find-unknown-comment-words
|
|
||||||
find-unknown-comment-words --directory kernel/ --lexicon ./kernel/.github/lexicon.txt
|
|
||||||
if [ "$?" = "0" ]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
formatting:
|
formatting:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4.1.1
|
||||||
- name: Install Uncrustify
|
- name: Check Formatting of FreeRTOS-Kernel Files
|
||||||
run: sudo apt-get install uncrustify=0.69.0+dfsg1-1build1
|
uses: FreeRTOS/CI-CD-Github-Actions/formatting@main
|
||||||
- name: Run Uncrustify
|
with:
|
||||||
run: |
|
exclude-dirs: portable
|
||||||
uncrustify --version
|
|
||||||
find . portable/MemMang/* portable/Common/* \( -name portable \) -prune -false -o -iname "*.[hc]" -exec uncrustify --check -c .github/uncrustify.cfg {} +
|
|
||||||
- name: Check For Trailing Whitespace
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
grep --exclude="*.md" --exclude-dir=".git" -rnI -e "[[:blank:]]$" .
|
|
||||||
if [ "$?" = "0" ]; then
|
|
||||||
echo "Files have trailing whitespace."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
- name: Check for CRLF
|
|
||||||
working-directory: ${{ inputs.path }}
|
|
||||||
run: |
|
|
||||||
set +e
|
|
||||||
find . -path ./.git -prune -o -exec file {} + | grep "CRLF"
|
|
||||||
if [ "$?" = "0" ]; then
|
|
||||||
echo "Files have CRLF line endings."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
url-check:
|
spell-check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone This Repo
|
- name: Clone This Repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
|
- name: Run spellings check
|
||||||
|
uses: FreeRTOS/CI-CD-Github-Actions/spellings@main
|
||||||
with:
|
with:
|
||||||
path: ./kernel
|
path: ./
|
||||||
- name: URL Checker
|
exclude-files: History.txt
|
||||||
run: |
|
|
||||||
bash kernel/.github/actions/url_verifier.sh kernel
|
link-verifier:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Clone This Repo
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
- name: Link Verification
|
||||||
|
uses: FreeRTOS/CI-CD-Github-Actions/link-verifier@main
|
||||||
|
with:
|
||||||
|
allowlist-file: '.github/allowed_urls.txt'
|
||||||
|
|
||||||
|
verify-manifest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4.1.1
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Run manifest verifier
|
||||||
|
uses: FreeRTOS/CI-CD-GitHub-Actions/manifest-verifier@main
|
||||||
|
with:
|
||||||
|
path: ./
|
||||||
|
fail-on-incorrect-version: true
|
||||||
|
|
127
.github/workflows/coverity_scan.yml
vendored
Normal file
127
.github/workflows/coverity_scan.yml
vendored
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
name: Coverity Scan
|
||||||
|
on:
|
||||||
|
# Run on every commit to mainline
|
||||||
|
push:
|
||||||
|
branches: main
|
||||||
|
# Allow manual running of the scan
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
bashPass: \033[32;1mPASSED -
|
||||||
|
bashInfo: \033[33;1mINFO -
|
||||||
|
bashFail: \033[31;1mFAILED -
|
||||||
|
bashEnd: \033[0m
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Coverity-Scan:
|
||||||
|
if: ( github.repository == 'FreeRTOS/FreeRTOS-Kernel' )
|
||||||
|
name: Coverity Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout the Repository
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Install Build Essentials
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
sudo apt-get -y update
|
||||||
|
sudo apt-get -y install build-essential
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Install Coverity Build
|
||||||
|
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
wget -nv -qO- https://scan.coverity.com/download/linux64 --post-data "token=${COVERITY_TOKEN}&project=FreeRTOS-Kernel" | tar -zx --one-top-level=cov_scan --strip-components 1
|
||||||
|
echo "cov_scan_path=$(pwd)/cov_scan/bin" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Coverity Build
|
||||||
|
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
|
COVERITY_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
export PATH="$PATH:${{env.cov_scan_path}}"
|
||||||
|
cmake -S ./examples/cmake_example/ -B build
|
||||||
|
cd build
|
||||||
|
cov-build --dir cov-int make -j
|
||||||
|
# Move the report out of the build directory
|
||||||
|
tar czvf ../gcc_freertos_kernel_sample_build.tgz cov-int
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Upload Coverity Report for Scan
|
||||||
|
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
|
COVERITY_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
COV_SCAN_UPLOAD_STATUS=$(curl --form token=${COVERITY_TOKEN} \
|
||||||
|
--form email=${COVERITY_EMAIL} \
|
||||||
|
--form file=@gcc_freertos_kernel_sample_build.tgz \
|
||||||
|
--form version="Mainline" \
|
||||||
|
--form description="FreeRTOS Kernel Commit Scan" \
|
||||||
|
https://scan.coverity.com/builds?project=FreeRTOS-Kernel)
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
|
||||||
|
echo "${COV_SCAN_UPLOAD_STATUS}" | grep -q -e 'Build successfully submitted' || echo >&2 "Error submitting build for analysis: ${COV_SCAN_UPLOAD_STATUS}"
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Coverity Build for SMP FreeRTOS
|
||||||
|
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
|
COVERITY_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
export PATH="$PATH:${{env.cov_scan_path}}"
|
||||||
|
cmake -S ./examples/cmake_example/ -B build -DFREERTOS_SMP_EXAMPLE=1
|
||||||
|
cd build
|
||||||
|
cov-build --dir cov-int make -j
|
||||||
|
# Move the report out of the build directory
|
||||||
|
tar czvf ../gcc_freertos_kernel_smp_sample_build.tgz cov-int
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Upload FreeRTOS SMP Coverity Report for Scan
|
||||||
|
COVERITY_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||||
|
COVERITY_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
COV_SCAN_UPLOAD_STATUS=$(curl --form token=${COVERITY_TOKEN} \
|
||||||
|
--form email=${COVERITY_EMAIL} \
|
||||||
|
--form file=@gcc_freertos_kernel_smp_sample_build.tgz \
|
||||||
|
--form version="Mainline" \
|
||||||
|
--form description="FreeRTOS Kernel SMP Commit Scan" \
|
||||||
|
https://scan.coverity.com/builds?project=FreeRTOS-Kernel)
|
||||||
|
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }} "
|
||||||
|
echo "${COV_SCAN_UPLOAD_STATUS}" | grep -q -e 'Build successfully submitted' || echo >&2 "Error submitting build for analysis: ${COV_SCAN_UPLOAD_STATUS}"
|
25
.github/workflows/formatting.yml
vendored
Normal file
25
.github/workflows/formatting.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
name: Format Pull Request Files
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
env:
|
||||||
|
bashPass: \033[32;1mPASSED -
|
||||||
|
bashInfo: \033[33;1mINFO -
|
||||||
|
bashFail: \033[31;1mFAILED -
|
||||||
|
bashEnd: \033[0m
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Formatting:
|
||||||
|
name: Run Formatting Check
|
||||||
|
if: ${{ github.event.issue.pull_request &&
|
||||||
|
( ( github.event.comment.body == '/bot run uncrustify' ) ||
|
||||||
|
( github.event.comment.body == '/bot run formatting' ) ) }}
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Apply Formatting Fix
|
||||||
|
id: check-formatting
|
||||||
|
uses: FreeRTOS/CI-CD-Github-Actions/formatting-bot@main
|
||||||
|
with:
|
||||||
|
exclude-dirs: portable
|
4
.github/workflows/git-secrets.yml
vendored
4
.github/workflows/git-secrets.yml
vendored
|
@ -7,11 +7,11 @@ jobs:
|
||||||
git-secrets:
|
git-secrets:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Checkout awslabs/git-secrets
|
- name: Checkout awslabs/git-secrets
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
repository: awslabs/git-secrets
|
repository: awslabs/git-secrets
|
||||||
ref: master
|
ref: master
|
||||||
|
|
41
.github/workflows/kernel-checks.yml
vendored
41
.github/workflows/kernel-checks.yml
vendored
|
@ -9,38 +9,61 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
# Install python 3
|
# Install python 3
|
||||||
- name: Tool Setup
|
- name: Tool Setup
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v3
|
||||||
with:
|
|
||||||
python-version: 3.7.10
|
|
||||||
architecture: x64
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# There is shared code, hosted by FreeRTOS/FreeRTOS, with deps needed by header checker
|
# There is shared code, hosted by FreeRTOS/FreeRTOS, with deps needed by header checker
|
||||||
- name: Checkout FreeRTOS Tools
|
- name: Checkout FreeRTOS Tools
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
repository: FreeRTOS/FreeRTOS
|
repository: FreeRTOS/FreeRTOS
|
||||||
|
sparse-checkout: '.github'
|
||||||
ref: main
|
ref: main
|
||||||
path: tools
|
path: tools
|
||||||
|
|
||||||
# Checkout user pull request changes
|
# Checkout user pull request changes
|
||||||
- name: Checkout Pull Request
|
- name: Checkout Pull Request
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
path: inspect
|
path: inspect
|
||||||
|
|
||||||
# Collect all affected files
|
# Collect all affected files
|
||||||
- name: Collecting changed files
|
- name: Collecting changed files
|
||||||
uses: lots0logs/gh-action-get-changed-files@2.1.4
|
uses: lots0logs/gh-action-get-changed-files@2.2.2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Run checks
|
# Run checks
|
||||||
- name: Check File Headers
|
- env:
|
||||||
|
bashPass: \033[32;1mPASSED -
|
||||||
|
bashInfo: \033[33;1mINFO -
|
||||||
|
bashFail: \033[31;1mFAILED -
|
||||||
|
bashEnd: \033[0m
|
||||||
|
stepName: Check File Headers
|
||||||
|
name: ${{ env.stepName }}
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} Install Dependencies ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
# Copy the common tools from the FreeRTOS/FreeRTOS repo.
|
||||||
mv tools/.github/scripts/common inspect/.github/scripts
|
mv tools/.github/scripts/common inspect/.github/scripts
|
||||||
|
|
||||||
|
# Install the necessary python dependencies
|
||||||
pip install -r inspect/.github/scripts/common/requirements.txt
|
pip install -r inspect/.github/scripts/common/requirements.txt
|
||||||
cd inspect
|
cd inspect
|
||||||
|
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
# Use the python script to check the copyright header of modified files.
|
||||||
.github/scripts/kernel_checker.py --json ${HOME}/files_modified.json ${HOME}/files_added.json ${HOME}/files_renamed.json
|
.github/scripts/kernel_checker.py --json ${HOME}/files_modified.json ${HOME}/files_added.json ${HOME}/files_renamed.json
|
||||||
exit $?
|
exitStatus=$?
|
||||||
|
echo -e "::endgroup::"
|
||||||
|
|
||||||
|
if [ $exitStatus -eq 0 ]; then
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
else
|
||||||
|
echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
fi
|
||||||
|
exit $exitStatus
|
||||||
|
|
208
.github/workflows/kernel-demos.yml
vendored
208
.github/workflows/kernel-demos.yml
vendored
|
@ -1,13 +1,20 @@
|
||||||
name: FreeRTOS-Kernel Demos
|
name: FreeRTOS-Kernel Demos
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
env:
|
||||||
|
# The bash escape character is \033
|
||||||
|
bashPass: \033[32;1mPASSED -
|
||||||
|
bashInfo: \033[33;1mINFO -
|
||||||
|
bashFail: \033[31;1mFAILED -
|
||||||
|
bashEnd: \033[0m
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
WIN32-MSVC:
|
WIN32-MSVC:
|
||||||
name: WIN32 MSVC
|
name: WIN32 MSVC
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
repository: FreeRTOS/FreeRTOS
|
repository: FreeRTOS/FreeRTOS
|
||||||
|
@ -16,7 +23,7 @@ jobs:
|
||||||
|
|
||||||
# Checkout user pull request changes
|
# Checkout user pull request changes
|
||||||
- name: Checkout Pull Request
|
- name: Checkout Pull Request
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
path: ./FreeRTOS/Source
|
path: ./FreeRTOS/Source
|
||||||
|
|
||||||
|
@ -36,7 +43,7 @@ jobs:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
repository: FreeRTOS/FreeRTOS
|
repository: FreeRTOS/FreeRTOS
|
||||||
|
@ -45,7 +52,7 @@ jobs:
|
||||||
|
|
||||||
# Checkout user pull request changes
|
# Checkout user pull request changes
|
||||||
- name: Checkout Pull Request
|
- name: Checkout Pull Request
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
path: ./FreeRTOS/Source
|
path: ./FreeRTOS/Source
|
||||||
|
|
||||||
|
@ -58,10 +65,16 @@ jobs:
|
||||||
|
|
||||||
POSIX-GCC:
|
POSIX-GCC:
|
||||||
name: Native GCC
|
name: Native GCC
|
||||||
runs-on: ubuntu-latest
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- macos-latest
|
||||||
|
- ubuntu-latest
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
repository: FreeRTOS/FreeRTOS
|
repository: FreeRTOS/FreeRTOS
|
||||||
|
@ -70,12 +83,13 @@ jobs:
|
||||||
|
|
||||||
# Checkout user pull request changes
|
# Checkout user pull request changes
|
||||||
- name: Checkout Pull Request
|
- name: Checkout Pull Request
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
path: ./FreeRTOS/Source
|
path: ./FreeRTOS/Source
|
||||||
|
|
||||||
- name: Install GCC
|
- name: Install GCC
|
||||||
shell: bash
|
shell: bash
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
sudo apt-get -y install build-essential
|
sudo apt-get -y install build-essential
|
||||||
|
@ -85,12 +99,45 @@ jobs:
|
||||||
working-directory: FreeRTOS/Demo/Posix_GCC
|
working-directory: FreeRTOS/Demo/Posix_GCC
|
||||||
run: make -j
|
run: make -j
|
||||||
|
|
||||||
|
- name: Build Posix_GCC Demo for Coverage Test
|
||||||
|
shell: bash
|
||||||
|
working-directory: FreeRTOS/Demo/Posix_GCC
|
||||||
|
run: make -j COVERAGE_TEST=1
|
||||||
|
|
||||||
|
CMake-Example:
|
||||||
|
name: CMake Example with Native GCC
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Checkout user pull request changes
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
|
||||||
|
- name: Install GCC
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt-get -y update
|
||||||
|
sudo apt-get -y install build-essential
|
||||||
|
|
||||||
|
- name: Build CMake Example Demo
|
||||||
|
shell: bash
|
||||||
|
working-directory: examples/cmake_example
|
||||||
|
run: |
|
||||||
|
cmake -S . -B build
|
||||||
|
cmake --build build
|
||||||
|
|
||||||
|
- name: Build CMake SMP Example Demo
|
||||||
|
shell: bash
|
||||||
|
working-directory: examples/cmake_example
|
||||||
|
run: |
|
||||||
|
cmake -S . -B build -DFREERTOS_SMP_EXAMPLE=1
|
||||||
|
cmake --build build
|
||||||
|
|
||||||
MSP430-GCC:
|
MSP430-GCC:
|
||||||
name: GNU MSP430 Toolchain
|
name: GNU MSP430 Toolchain
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
repository: FreeRTOS/FreeRTOS
|
repository: FreeRTOS/FreeRTOS
|
||||||
|
@ -99,36 +146,139 @@ jobs:
|
||||||
|
|
||||||
# Checkout user pull request changes
|
# Checkout user pull request changes
|
||||||
- name: Checkout Pull Request
|
- name: Checkout Pull Request
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
path: ./FreeRTOS/Source
|
path: ./FreeRTOS/Source
|
||||||
|
|
||||||
- name: Install MSP430 Toolchain
|
- env:
|
||||||
|
stepName: Install MSP430 Toolchain
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -y update
|
# ${{ env.stepName }}
|
||||||
sudo apt-get -y install gcc-msp430 build-essential
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
curl -L -O https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-LlCjWuAbzH/9.3.1.2/msp430-gcc-full-linux-x64-installer-9.3.1.2.7z
|
||||||
|
sudo apt update -y
|
||||||
|
sudo apt install -y p7zip-full
|
||||||
|
7z x ./msp430-gcc-full-linux-x64-installer-9.3.1.2.7z
|
||||||
|
chmod +x ./msp430-gcc-full-linux-x64-installer-9.3.1.2.run
|
||||||
|
sudo ./msp430-gcc-full-linux-x64-installer-9.3.1.2.run --prefix /usr/bin/msp430-gcc --mode unattended
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
- name: Build msp430_GCC Demo
|
- name: Build msp430_GCC Demo
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: FreeRTOS/Demo/msp430_GCC
|
working-directory: FreeRTOS/Demo/msp430_GCC
|
||||||
run: make -j
|
run: make -j CC=/usr/bin/msp430-gcc/bin/msp430-elf-gcc OPT="-Os -I/usr/bin/msp430-gcc/include -L/usr/bin/msp430-gcc/include"
|
||||||
|
|
||||||
|
MicroBlaze-GCC:
|
||||||
|
name: GCC MicroBlaze Toolchain
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
with:
|
||||||
|
ref: main
|
||||||
|
repository: FreeRTOS/FreeRTOS
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Fetch Community-Supported-Demos Submodule
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos
|
||||||
|
# This repository contains the microblaze_instructions.h header file
|
||||||
|
git clone https://github.com/Xilinx/embeddedsw.git --branch xilinx_v2023.1
|
||||||
|
echo "::endgroup::"
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
# Checkout user pull request changes
|
||||||
|
- name: Checkout Pull Request
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
with:
|
||||||
|
path: ./FreeRTOS/Source
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Install Dependancies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
sudo apt update -y
|
||||||
|
sudo apt upgrade -y
|
||||||
|
sudo apt install -y build-essential m4 debhelper bison texinfo dejagnu flex
|
||||||
|
sudo apt install -y autogen gawk libgmp-dev libmpc-dev libmpfr-dev
|
||||||
|
sudo apt install -y patchutils sharutils zlib1g-dev autoconf2.64
|
||||||
|
|
||||||
|
# Download the mb-gcc toolchain from github
|
||||||
|
curl -L -O https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/binutils-microblaze_2.35-2021-0623+1_amd64.deb;
|
||||||
|
curl -L -O https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/gcc-microblaze_10.2.0-2021-0623+2_amd64.deb;
|
||||||
|
curl -L -O https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/libnewlib-microblaze-dev_3.3.0-2021-0623+3_all.deb;
|
||||||
|
curl -L -O https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/libnewlib-microblaze-doc_3.3.0-2021-0623+3_all.deb;
|
||||||
|
curl -L -O https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/libnewlib-microblaze_3.3.0-2021-0623+3_all.deb;
|
||||||
|
curl -L -O https://github.com/mdednev/mb-gcc/releases/download/2021-0623%2B2/newlib-source_3.3.0-2021-0623+3_all.deb;
|
||||||
|
|
||||||
|
# Install the packages for the toolchain
|
||||||
|
sudo apt install -y ./binutils-microblaze*.deb;
|
||||||
|
sudo apt install -y ./gcc-microblaze*.deb;
|
||||||
|
sudo apt install -y ./libnewlib-microblaze-dev*.deb;
|
||||||
|
sudo apt install -y ./libnewlib-microblaze-doc*.deb;
|
||||||
|
sudo apt install -y ./libnewlib-microblaze*.deb;
|
||||||
|
sudo apt install -y ./newlib-source*.deb;
|
||||||
|
|
||||||
|
# Validate that the toolchain is in the path and can be called
|
||||||
|
which mb-gcc
|
||||||
|
mb-gcc --version
|
||||||
|
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Compile Microblaze Port
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
# Compile MicroBlazeV9 Port files to validate they build
|
||||||
|
mb-gcc -mcpu=v9.5 -c \
|
||||||
|
FreeRTOS/Source/portable/GCC/MicroBlazeV9/port.c \
|
||||||
|
FreeRTOS/Source/portable/GCC/MicroBlazeV9/portasm.S \
|
||||||
|
FreeRTOS/Source/portable/GCC/MicroBlazeV9/port_exceptions.c \
|
||||||
|
FreeRTOS/Source/tasks.c \
|
||||||
|
FreeRTOS/Source/list.c \
|
||||||
|
-I embeddedsw/lib/bsp/standalone/src/microblaze \
|
||||||
|
-I FreeRTOS/Source/portable/GCC/MicroBlazeV9/ \
|
||||||
|
-I FreeRTOS/Source/include \
|
||||||
|
-I FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src \
|
||||||
|
-I FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/BSP/microblaze_0/libsrc/standalone_v5_4/src \
|
||||||
|
-I FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/BSP/microblaze_0/include \
|
||||||
|
-I FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/BSP/microblaze_0/libsrc/intc_v3_5/src
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
|
|
||||||
ARM-GCC:
|
ARM-GCC:
|
||||||
name: GNU ARM Toolchain
|
name: GNU ARM Toolchain
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
- name: Checkout the FreeRTOS/FreeRTOS Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
repository: FreeRTOS/FreeRTOS
|
repository: FreeRTOS/FreeRTOS
|
||||||
submodules: 'recursive'
|
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- env:
|
||||||
|
stepName: Fetch Dependencies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# ${{ env.stepName }}
|
||||||
|
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
git submodule update --checkout --init --depth 1 FreeRTOS/Demo/ThirdParty/Community-Supported-Demos FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace
|
||||||
|
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
|
||||||
|
|
||||||
# Checkout user pull request changes
|
# Checkout user pull request changes
|
||||||
- name: Checkout Pull Request
|
- name: Checkout Pull Request
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
path: ./FreeRTOS/Source
|
path: ./FreeRTOS/Source
|
||||||
|
|
||||||
|
@ -143,25 +293,21 @@ jobs:
|
||||||
working-directory: FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC
|
working-directory: FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC
|
||||||
run: make -j
|
run: make -j
|
||||||
|
|
||||||
|
- name: Build CORTEX_MPU_R4F_TI_RM46_HERCULES_GCC Demo
|
||||||
|
shell: bash
|
||||||
|
working-directory: FreeRTOS/Demo/CORTEX_MPU_R4F_TI_RM46_HERCULES_GCC
|
||||||
|
run: cmake -S . -B build && make -j -C build all
|
||||||
|
|
||||||
|
- name: Build CORTEX_MPU_R5F_TI_RM57_HERCULES_GCC Demo
|
||||||
|
shell: bash
|
||||||
|
working-directory: FreeRTOS/Demo/CORTEX_MPU_R5F_TI_RM57_HERCULES_GCC
|
||||||
|
run: cmake -S . -B build && make -j -C build all
|
||||||
|
|
||||||
- name: Build CORTEX_LM3S102_GCC Demo
|
- name: Build CORTEX_LM3S102_GCC Demo
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: FreeRTOS/Demo/CORTEX_LM3S102_GCC
|
working-directory: FreeRTOS/Demo/CORTEX_LM3S102_GCC
|
||||||
run: make -j
|
run: make -j
|
||||||
|
|
||||||
- name: Build CORTEX_M3_MPS2_QEMU_GCC Demo
|
|
||||||
shell: bash
|
|
||||||
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
|
|
||||||
run: |
|
|
||||||
make clean
|
|
||||||
make -j
|
|
||||||
|
|
||||||
- name: Build CORTEX_M3_MPS2_QEMU_GCC Demo
|
|
||||||
shell: bash
|
|
||||||
working-directory: FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
|
|
||||||
run: |
|
|
||||||
make clean
|
|
||||||
make FULL_DEMO=1 -j
|
|
||||||
|
|
||||||
- name: Build CORTEX_LM3S811_GCC Demo
|
- name: Build CORTEX_LM3S811_GCC Demo
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: FreeRTOS/Demo/CORTEX_LM3S811_GCC
|
working-directory: FreeRTOS/Demo/CORTEX_LM3S811_GCC
|
||||||
|
@ -169,7 +315,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build CORTEX_M0+_RP2040 Demos
|
- name: Build CORTEX_M0+_RP2040 Demos
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: FreeRTOS/Demo/ThirdParty/Community-Supported/CORTEX_M0+_RP2040
|
working-directory: FreeRTOS/Demo/ThirdParty/Community-Supported-Demos/CORTEX_M0+_RP2040
|
||||||
run: |
|
run: |
|
||||||
git clone https://github.com/raspberrypi/pico-sdk.git
|
git clone https://github.com/raspberrypi/pico-sdk.git
|
||||||
cmake -B build -DPICO_SDK_PATH=pico-sdk -GNinja
|
cmake -B build -DPICO_SDK_PATH=pico-sdk -GNinja
|
||||||
|
|
8
.github/workflows/unit-tests.yml
vendored
8
.github/workflows/unit-tests.yml
vendored
|
@ -6,7 +6,7 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Parent Repository
|
- name: Checkout Parent Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
ref: main
|
ref: main
|
||||||
repository: FreeRTOS/FreeRTOS
|
repository: FreeRTOS/FreeRTOS
|
||||||
|
@ -15,7 +15,7 @@ jobs:
|
||||||
|
|
||||||
# Checkout user pull request changes
|
# Checkout user pull request changes
|
||||||
- name: Checkout Pull Request
|
- name: Checkout Pull Request
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
path: ./FreeRTOS/Source
|
path: ./FreeRTOS/Source
|
||||||
|
|
||||||
|
@ -45,12 +45,12 @@ jobs:
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: false
|
||||||
verbose: false
|
verbose: false
|
||||||
- name: Archive code coverage data
|
- name: Archive code coverage data
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: coverage-data
|
name: coverage-data
|
||||||
path: FreeRTOS/Test/CMock/build/cmock_test*
|
path: FreeRTOS/Test/CMock/build/cmock_test*
|
||||||
- name: Archive code coverage html report
|
- name: Archive code coverage html report
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: coverage-report
|
name: coverage-report
|
||||||
path: FreeRTOS/Test/CMock/build/coverage
|
path: FreeRTOS/Test/CMock/build/coverage
|
||||||
|
|
|
@ -4,14 +4,16 @@ cmake_minimum_required(VERSION 3.15)
|
||||||
# FREERTOS_PORT, if not specified and native port detected, uses the native compile.
|
# FREERTOS_PORT, if not specified and native port detected, uses the native compile.
|
||||||
#
|
#
|
||||||
# User is responsible for one library target:
|
# User is responsible for one library target:
|
||||||
# freertos_config ,typcially an INTERFACE library
|
# freertos_config ,typically an INTERFACE library
|
||||||
#
|
#
|
||||||
# DEPRECATED: FREERTOS_CONFIG_FILE_DIRECTORY - but still supported if no freertos_config defined for now.
|
# DEPRECATED: FREERTOS_CONFIG_FILE_DIRECTORY - but still supported if no freertos_config defined for now.
|
||||||
# May be removed at some point in the future.
|
# May be removed at some point in the future.
|
||||||
|
#
|
||||||
# User can choose which heap implementation to use (either the implementations
|
# User can choose which heap implementation to use (either the implementations
|
||||||
# included with FreeRTOS [1..5] or a custom implementation) by providing the
|
# included with FreeRTOS [1..5] or a custom implementation) by providing the
|
||||||
# option FREERTOS_HEAP. If the option is not set, the cmake will default to
|
# option FREERTOS_HEAP. When dynamic allocation is used, the user must specify a
|
||||||
# using heap_4.c.
|
# heap implementation. If the option is not set, the cmake will use no heap
|
||||||
|
# implementation (e.g. when only static allocation is used).
|
||||||
|
|
||||||
# `freertos_config` target defines the path to FreeRTOSConfig.h and optionally other freertos based config files
|
# `freertos_config` target defines the path to FreeRTOSConfig.h and optionally other freertos based config files
|
||||||
if(NOT TARGET freertos_config )
|
if(NOT TARGET freertos_config )
|
||||||
|
@ -37,9 +39,6 @@ if(NOT TARGET freertos_config )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Heap number or absolute path to custom heap implementation provided by user
|
|
||||||
set(FREERTOS_HEAP "4" CACHE STRING "FreeRTOS heap model number. 1 .. 5. Or absolute path to custom heap source file")
|
|
||||||
|
|
||||||
# FreeRTOS port option
|
# FreeRTOS port option
|
||||||
if(NOT FREERTOS_PORT)
|
if(NOT FREERTOS_PORT)
|
||||||
message(WARNING " FREERTOS_PORT is not set. Please specify it from top-level CMake file (example):\n"
|
message(WARNING " FREERTOS_PORT is not set. Please specify it from top-level CMake file (example):\n"
|
||||||
|
@ -59,8 +58,8 @@ if(NOT FREERTOS_PORT)
|
||||||
" CODEWARRIOR_COLDFIRE_V2 - Compiler: CoreWarrior Target: ColdFire V2\n"
|
" CODEWARRIOR_COLDFIRE_V2 - Compiler: CoreWarrior Target: ColdFire V2\n"
|
||||||
" CODEWARRIOR_HCS12 - Compiler: CoreWarrior Target: HCS12\n"
|
" CODEWARRIOR_HCS12 - Compiler: CoreWarrior Target: HCS12\n"
|
||||||
" GCC_ARM_CA9 - Compiler: GCC Target: ARM Cortex-A9\n"
|
" GCC_ARM_CA9 - Compiler: GCC Target: ARM Cortex-A9\n"
|
||||||
" GCC_ARM_CA53_64_BIT - Compiler: GCC Target: ARM Cortex-A53 64 bit\n"
|
" GCC_ARM_AARCH64 - Compiler: GCC Target: ARM v8-A\n"
|
||||||
" GCC_ARM_CA53_64_BIT_SRE - Compiler: GCC Target: ARM Cortex-A53 64 bit SRE\n"
|
" GCC_ARM_AARCH64_SRE - Compiler: GCC Target: ARM v8-A SRE\n"
|
||||||
" GCC_ARM_CM0 - Compiler: GCC Target: ARM Cortex-M0\n"
|
" GCC_ARM_CM0 - Compiler: GCC Target: ARM Cortex-M0\n"
|
||||||
" GCC_ARM_CM3 - Compiler: GCC Target: ARM Cortex-M3\n"
|
" GCC_ARM_CM3 - Compiler: GCC Target: ARM Cortex-M3\n"
|
||||||
" GCC_ARM_CM3_MPU - Compiler: GCC Target: ARM Cortex-M3 with MPU\n"
|
" GCC_ARM_CM3_MPU - Compiler: GCC Target: ARM Cortex-M3 with MPU\n"
|
||||||
|
@ -86,6 +85,7 @@ if(NOT FREERTOS_PORT)
|
||||||
" GCC_ARM_CM85_NTZ_NONSECURE - Compiler: GCC Target: ARM Cortex-M85 non-trustzone non-secure\n"
|
" GCC_ARM_CM85_NTZ_NONSECURE - Compiler: GCC Target: ARM Cortex-M85 non-trustzone non-secure\n"
|
||||||
" GCC_ARM_CM85_TFM - Compiler: GCC Target: ARM Cortex-M85 non-secure for TF-M\n"
|
" GCC_ARM_CM85_TFM - Compiler: GCC Target: ARM Cortex-M85 non-secure for TF-M\n"
|
||||||
" GCC_ARM_CR5 - Compiler: GCC Target: ARM Cortex-R5\n"
|
" GCC_ARM_CR5 - Compiler: GCC Target: ARM Cortex-R5\n"
|
||||||
|
" GCC_ARM_CRX_MPU - Compiler: GCC Target: ARM Cortex-Rx with MPU\n"
|
||||||
" GCC_ARM_CRX_NOGIC - Compiler: GCC Target: ARM Cortex-Rx no GIC\n"
|
" GCC_ARM_CRX_NOGIC - Compiler: GCC Target: ARM Cortex-Rx no GIC\n"
|
||||||
" GCC_ARM7_AT91FR40008 - Compiler: GCC Target: ARM7 Atmel AT91R40008\n"
|
" GCC_ARM7_AT91FR40008 - Compiler: GCC Target: ARM7 Atmel AT91R40008\n"
|
||||||
" GCC_ARM7_AT91SAM7S - Compiler: GCC Target: ARM7 Atmel AT91SAM7S\n"
|
" GCC_ARM7_AT91SAM7S - Compiler: GCC Target: ARM7 Atmel AT91SAM7S\n"
|
||||||
|
@ -107,6 +107,7 @@ if(NOT FREERTOS_PORT)
|
||||||
" GCC_PPC440_XILINX - Compiler: GCC Target: Xilinx PPC440\n"
|
" GCC_PPC440_XILINX - Compiler: GCC Target: Xilinx PPC440\n"
|
||||||
" GCC_RISC_V - Compiler: GCC Target: RISC-V\n"
|
" GCC_RISC_V - Compiler: GCC Target: RISC-V\n"
|
||||||
" GCC_RISC_V_PULPINO_VEGA_RV32M1RM - Compiler: GCC Target: RISC-V Pulpino Vega RV32M1RM\n"
|
" GCC_RISC_V_PULPINO_VEGA_RV32M1RM - Compiler: GCC Target: RISC-V Pulpino Vega RV32M1RM\n"
|
||||||
|
" GCC_RISC_V_GENERIC - Compiler: GCC Target: RISC-V with FREERTOS_RISCV_EXTENSION\n"
|
||||||
" GCC_RL78 - Compiler: GCC Target: Renesas RL78\n"
|
" GCC_RL78 - Compiler: GCC Target: Renesas RL78\n"
|
||||||
" GCC_RX100 - Compiler: GCC Target: Renesas RX100\n"
|
" GCC_RX100 - Compiler: GCC Target: Renesas RX100\n"
|
||||||
" GCC_RX200 - Compiler: GCC Target: Renesas RX200\n"
|
" GCC_RX200 - Compiler: GCC Target: Renesas RX200\n"
|
||||||
|
@ -137,15 +138,18 @@ if(NOT FREERTOS_PORT)
|
||||||
" IAR_ARM_CM33_NONSECURE - Compiler: IAR Target: ARM Cortex-M33 non-secure\n"
|
" IAR_ARM_CM33_NONSECURE - Compiler: IAR Target: ARM Cortex-M33 non-secure\n"
|
||||||
" IAR_ARM_CM33_SECURE - Compiler: IAR Target: ARM Cortex-M33 secure\n"
|
" IAR_ARM_CM33_SECURE - Compiler: IAR Target: ARM Cortex-M33 secure\n"
|
||||||
" IAR_ARM_CM33_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M33 non-trustzone non-secure\n"
|
" IAR_ARM_CM33_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M33 non-trustzone non-secure\n"
|
||||||
|
" IAR_ARM_CM33_TFM - Compiler: IAR Target: ARM Cortex-M33 non-secure for TF-M\n"
|
||||||
" IAR_ARM_CM35P_NONSECURE - Compiler: IAR Target: ARM Cortex-M35P non-secure\n"
|
" IAR_ARM_CM35P_NONSECURE - Compiler: IAR Target: ARM Cortex-M35P non-secure\n"
|
||||||
" IAR_ARM_CM35P_SECURE - Compiler: IAR Target: ARM Cortex-M35P secure\n"
|
" IAR_ARM_CM35P_SECURE - Compiler: IAR Target: ARM Cortex-M35P secure\n"
|
||||||
" IAR_ARM_CM35P_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M35P non-trustzone non-secure\n"
|
" IAR_ARM_CM35P_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M35P non-trustzone non-secure\n"
|
||||||
" IAR_ARM_CM55_NONSECURE - Compiler: IAR Target: ARM Cortex-M55 non-secure\n"
|
" IAR_ARM_CM55_NONSECURE - Compiler: IAR Target: ARM Cortex-M55 non-secure\n"
|
||||||
" IAR_ARM_CM55_SECURE - Compiler: IAR Target: ARM Cortex-M55 secure\n"
|
" IAR_ARM_CM55_SECURE - Compiler: IAR Target: ARM Cortex-M55 secure\n"
|
||||||
" IAR_ARM_CM55_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M55 non-trustzone non-secure\n"
|
" IAR_ARM_CM55_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M55 non-trustzone non-secure\n"
|
||||||
|
" IAR_ARM_CM55_TFM - Compiler: IAR Target: ARM Cortex-M55 non-secure for TF-M\n"
|
||||||
" IAR_ARM_CM85_NONSECURE - Compiler: IAR Target: ARM Cortex-M85 non-secure\n"
|
" IAR_ARM_CM85_NONSECURE - Compiler: IAR Target: ARM Cortex-M85 non-secure\n"
|
||||||
" IAR_ARM_CM85_SECURE - Compiler: IAR Target: ARM Cortex-M85 secure\n"
|
" IAR_ARM_CM85_SECURE - Compiler: IAR Target: ARM Cortex-M85 secure\n"
|
||||||
" IAR_ARM_CM85_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M85 non-trustzone non-secure\n"
|
" IAR_ARM_CM85_NTZ_NONSECURE - Compiler: IAR Target: ARM Cortex-M85 non-trustzone non-secure\n"
|
||||||
|
" IAR_ARM_CM85_TFM - Compiler: IAR Target: ARM Cortex-M85 non-secure for TF-M\n"
|
||||||
" IAR_ARM_CRX_NOGIC - Compiler: IAR Target: ARM Cortex-Rx no GIC\n"
|
" IAR_ARM_CRX_NOGIC - Compiler: IAR Target: ARM Cortex-Rx no GIC\n"
|
||||||
" IAR_ATMEGA323 - Compiler: IAR Target: ATMega323\n"
|
" IAR_ATMEGA323 - Compiler: IAR Target: ATMega323\n"
|
||||||
" IAR_ATMEL_SAM7S64 - Compiler: IAR Target: Atmel SAM7S64\n"
|
" IAR_ATMEL_SAM7S64 - Compiler: IAR Target: Atmel SAM7S64\n"
|
||||||
|
@ -157,6 +161,7 @@ if(NOT FREERTOS_PORT)
|
||||||
" IAR_MSP430 - Compiler: IAR Target: MSP430\n"
|
" IAR_MSP430 - Compiler: IAR Target: MSP430\n"
|
||||||
" IAR_MSP430X - Compiler: IAR Target: MSP430X\n"
|
" IAR_MSP430X - Compiler: IAR Target: MSP430X\n"
|
||||||
" IAR_RISC_V - Compiler: IAR Target: RISC-V\n"
|
" IAR_RISC_V - Compiler: IAR Target: RISC-V\n"
|
||||||
|
" IAR_RISC_V_GENERIC - Compiler: IAR Target: RISC-V with FREERTOS_RISCV_EXTENSION\n"
|
||||||
" IAR_RL78 - Compiler: IAR Target: Renesas RL78\n"
|
" IAR_RL78 - Compiler: IAR Target: Renesas RL78\n"
|
||||||
" IAR_RX100 - Compiler: IAR Target: Renesas RX100\n"
|
" IAR_RX100 - Compiler: IAR Target: Renesas RX100\n"
|
||||||
" IAR_RX600 - Compiler: IAR Target: Renesas RX600\n"
|
" IAR_RX600 - Compiler: IAR Target: Renesas RX600\n"
|
||||||
|
@ -196,6 +201,7 @@ if(NOT FREERTOS_PORT)
|
||||||
" SOFTUNE_MB91460 - Compiler: Softune Target: MB91460\n"
|
" SOFTUNE_MB91460 - Compiler: Softune Target: MB91460\n"
|
||||||
" SOFTUNE_MB96340 - Compiler: Softune Target: MB96340\n"
|
" SOFTUNE_MB96340 - Compiler: Softune Target: MB96340\n"
|
||||||
" TASKING_ARM_CM4F - Compiler: Tasking Target: ARM Cortex-M4 with FPU\n"
|
" TASKING_ARM_CM4F - Compiler: Tasking Target: ARM Cortex-M4 with FPU\n"
|
||||||
|
" TEMPLATE - Compiler: HOST Target: None\n"
|
||||||
" CDK_THEAD_CK802 - Compiler: CDK Target: T-head CK802\n"
|
" CDK_THEAD_CK802 - Compiler: CDK Target: T-head CK802\n"
|
||||||
" XCC_XTENSA - Compiler: XCC Target: Xtensa\n"
|
" XCC_XTENSA - Compiler: XCC Target: Xtensa\n"
|
||||||
" WIZC_PIC18 - Compiler: WizC Target: PIC18")
|
" WIZC_PIC18 - Compiler: WizC Target: PIC18")
|
||||||
|
@ -215,59 +221,27 @@ elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_
|
||||||
" port.c\n"
|
" port.c\n"
|
||||||
" portmacro.h\n"
|
" portmacro.h\n"
|
||||||
" Where FreeRTOSCustomPort/CMakeLists.txt is a modified version of:\n"
|
" Where FreeRTOSCustomPort/CMakeLists.txt is a modified version of:\n"
|
||||||
" add_library(freertos_kernel_port STATIC)\n"
|
" add_library(freertos_kernel_port OBJECT)\n"
|
||||||
" target_sources(freertos_kernel_port\n"
|
" target_sources(freertos_kernel_port\n"
|
||||||
" PRIVATE\n"
|
" PRIVATE\n"
|
||||||
" port.c\n"
|
" port.c\n"
|
||||||
" portmacro.h)\n"
|
" portmacro.h)\n"
|
||||||
" target_include_directories(freertos_kernel_port\n"
|
" add_library(freertos_kernel_port_headers INTERFACE)\n"
|
||||||
" PUBLIC\n"
|
" target_include_directories(freertos_kernel_port_headers INTERFACE \n"
|
||||||
" .)\n"
|
" .)\n"
|
||||||
" target_link_libraries(freertos_kernel_port\n"
|
" target_link_libraries(freertos_kernel_port\n"
|
||||||
" PRIVATE\n"
|
" PRIVATE\n"
|
||||||
|
" freertos_kernel_port_headers\n"
|
||||||
" freertos_kernel_include)")
|
" freertos_kernel_include)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
add_library(freertos_kernel STATIC)
|
||||||
# Overall Compile Options
|
|
||||||
# Note the compile option strategy is to error on everything and then
|
|
||||||
# Per library opt-out of things that are warnings/errors.
|
|
||||||
# This ensures that no matter what strategy for compilation you take, the
|
|
||||||
# builds will still occur.
|
|
||||||
#
|
|
||||||
# Only tested with GNU and Clang.
|
|
||||||
# Other options are https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID
|
|
||||||
# Naming of compilers translation map:
|
|
||||||
#
|
|
||||||
# FreeRTOS | CMake
|
|
||||||
# -------------------
|
|
||||||
# CCS | ?TBD?
|
|
||||||
# GCC | GNU, Clang, *Clang Others?
|
|
||||||
# IAR | IAR
|
|
||||||
# Keil | ARMCC
|
|
||||||
# MSVC | MSVC # Note only for MinGW?
|
|
||||||
# Renesas | ?TBD?
|
|
||||||
|
|
||||||
add_compile_options(
|
|
||||||
### Gnu/Clang C Options
|
|
||||||
$<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always>
|
|
||||||
$<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics>
|
|
||||||
|
|
||||||
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
|
|
||||||
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
|
|
||||||
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic>
|
|
||||||
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
|
|
||||||
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
|
|
||||||
|
|
||||||
# TODO: Add in other Compilers here.
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
add_subdirectory(include)
|
add_subdirectory(include)
|
||||||
add_subdirectory(portable)
|
add_subdirectory(portable)
|
||||||
|
|
||||||
add_library(freertos_kernel STATIC
|
target_sources(freertos_kernel PRIVATE
|
||||||
croutine.c
|
croutine.c
|
||||||
event_groups.c
|
event_groups.c
|
||||||
list.c
|
list.c
|
||||||
|
@ -275,15 +249,24 @@ add_library(freertos_kernel STATIC
|
||||||
stream_buffer.c
|
stream_buffer.c
|
||||||
tasks.c
|
tasks.c
|
||||||
timers.c
|
timers.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if (DEFINED FREERTOS_HEAP )
|
||||||
|
# User specified a heap implementation add heap implementation to freertos_kernel.
|
||||||
|
target_sources(freertos_kernel PRIVATE
|
||||||
# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
|
# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
|
||||||
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
|
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(freertos_kernel
|
target_link_libraries(freertos_kernel
|
||||||
PUBLIC
|
PUBLIC
|
||||||
freertos_kernel_port
|
|
||||||
freertos_kernel_include
|
freertos_kernel_include
|
||||||
|
freertos_kernel_port_headers
|
||||||
|
PRIVATE
|
||||||
|
freertos_kernel_port
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
342
History.txt
342
History.txt
|
@ -1,5 +1,335 @@
|
||||||
Documentation and download available at https://www.FreeRTOS.org/
|
Documentation and download available at https://www.FreeRTOS.org/
|
||||||
|
|
||||||
|
Changes between FreeRTOS V11.1.0 and FreeRTOS V11.2.0 released March 04, 2025
|
||||||
|
|
||||||
|
+ Add CC-RH port for Renesas F1Kx devices. We thank @TrongNguyenR for their
|
||||||
|
contribution.
|
||||||
|
+ Add Pointer Authentication (PAC) and Branch Target Identification (BTI)
|
||||||
|
support to the ARMv8-M ports. We thank @AhmedIsmail02 for their
|
||||||
|
contribution.
|
||||||
|
+ Add Floating Point Unit (FPU) support to the ARM_AARCH64 port. We thank
|
||||||
|
@StefanBalt for their contribution.
|
||||||
|
+ Add FPU Safe Application IRQ Handler suport to the ARM_AARCH64_SRE port.
|
||||||
|
We thank @GhMarwen for their contribution.
|
||||||
|
+ Add Privileged eXecute Never MPU attribute support to the ARMv8-M ports.
|
||||||
|
We thank @AhmedIsmail02 for their contribution.
|
||||||
|
+ Update XMOS xcore.ai port to be compatible with FreeRTOS Kernel version
|
||||||
|
11. We thank @ACascarino for their contribution.
|
||||||
|
+ ARM_CRx_No_GIC port updates:
|
||||||
|
- Remove inline assembly and move assembly code to separate portASM.S
|
||||||
|
file.
|
||||||
|
- Add support for Floating Point Unit (FPU).
|
||||||
|
- Add support to allow the application writer to handle SVC calls raised
|
||||||
|
from the application code.
|
||||||
|
- Add support for vApplicationFPUSafeIRQHandler.
|
||||||
|
+ POSIX port updates:
|
||||||
|
- Set PTHREAD_MUTEX_ROBUST attribute on the mutex to prevent application
|
||||||
|
hangs when a thread dies while holding a mutex.
|
||||||
|
- Avoid calling pthread_sigmask on non-FreeROS threads when
|
||||||
|
vPortEndScheduler is called from a non-FreeRTOS thread. We thank
|
||||||
|
@johnboiles for their contribution.
|
||||||
|
- Remove unnecessary call to pthread_attr_setstacksize. We thank
|
||||||
|
@hollinsky for their contribution.
|
||||||
|
- Add an assert to catch if vPortYield is called from a non-FreeRTOS
|
||||||
|
thread. We thank @johnboiles for their contribution.
|
||||||
|
- Fix Posix port compilation on FreeBSD. We thank @tymmej for their
|
||||||
|
contribution.
|
||||||
|
+ Update the Xtensa port and move it to the Partner-Supported-Ports
|
||||||
|
repository. We thank @ianstcdns for their contribution.
|
||||||
|
+ Add vPortGenerateSimulatedInterruptFromWindowsThread API in the MSVC-MingW
|
||||||
|
port to enable native windows thread to synchronize with FreeRTOS task
|
||||||
|
through simulated interrupt.
|
||||||
|
+ Update Windows port to use Waitable Timer instead of Sleep to improve tick
|
||||||
|
accuracy. We thank @bknicholls and @leegeth for their contribution.
|
||||||
|
+ Update the value of queueQUEUE_TYPE_SET to a unique value (5) to allow
|
||||||
|
tracers to differentiate between queues and queue sets. We thank @schilkp
|
||||||
|
for their contribution.
|
||||||
|
+ Add traceSTARTING_SCHEDULER tracing hook to enable tracers to run code on
|
||||||
|
startup. We thank @schilkp for their contribution.
|
||||||
|
+ Define vApplicationGetTimerTaskMemory only when configUSE_TIMERS is set to
|
||||||
|
1. We thank @HazardyKnusperkeks for their contribution.
|
||||||
|
+ Reset xNextTaskUnblockTime in task notify FromISR APIs to allow the core
|
||||||
|
to enter sleep mode at the earliest possible time when using tickless
|
||||||
|
idle.
|
||||||
|
+ Optimize xTaskIncrementTick for SMP by removing xYieldRequiredForCore. We
|
||||||
|
thank @cymizer for their contribution.
|
||||||
|
+ Update the SMP scheduler to re-select a core to yield when the core
|
||||||
|
affinity of a ready task is changed.
|
||||||
|
+ Update xEventGroupSetBits to read the event bits value to be returned to
|
||||||
|
the caller while the scheduler is suspended. This fixes dereference after
|
||||||
|
the event group is deleted by higher priority task. We thank @skotopes for
|
||||||
|
their contribution.
|
||||||
|
+ Optimize certain getter APIs by removing unnecessary calls to
|
||||||
|
task{ENTER|EXIT}_CRITICAL() when the data access is atomic. We thank
|
||||||
|
@GuilhermeGiacomoSimoes for their contribution.
|
||||||
|
+ Optimize xTaskNotifyWait and ulTaskNotifyTake APIs to suspend the
|
||||||
|
scheduler only if the task is not already notified, and the caller is
|
||||||
|
willing to wait for the notification. We thank @jefftenney for
|
||||||
|
their contribution.
|
||||||
|
+ Fix error checking of prvCreateIdleTasks. We thank @kakkoko for their
|
||||||
|
contribution.
|
||||||
|
+ Update SMP lock macros and critical nesting macros to pass core ID as an
|
||||||
|
argument. This reduces the number of accesses to a peripheral register to
|
||||||
|
query core ID. We thank @felixvanoost for their contribution.
|
||||||
|
+ Add stack pointer bounds check when configCHECK_FOR_STACK_OVERFLOW is set
|
||||||
|
to 2 to improve reliability of stack overflow detection. We thank
|
||||||
|
@jiladahe1997 for their contribution.
|
||||||
|
+ Update run-time stats to include time elapsed since the last context
|
||||||
|
switch for the currently running task.
|
||||||
|
+ Add xQueueCreateSetStatic API for static creation of Queue Sets. We thank
|
||||||
|
@kzorer for their contribution.
|
||||||
|
+ Update the traceMALLOC() macro to pass the actual size of the allocated
|
||||||
|
block for secure_heap, heap_2, heap_4 and heap_5. We thank @DazzlingOkami
|
||||||
|
for their contribution.
|
||||||
|
+ Update heap_1 to use heapADD_WILL_OVERFLOW macro to improve readability.
|
||||||
|
We thank @wdfk-prog for their contribution.
|
||||||
|
+ Add pointer protection to the pxNextFreeBlock member of the allocated
|
||||||
|
block's metadata in heap_4 and heap_5 when configENABLE_HEAP_PROTECTOR is
|
||||||
|
set to 1. We thank @Saiiijchan for their contribution.
|
||||||
|
+ Allow the application writer to override pointer validation for heap_5
|
||||||
|
when configENABLE_HEAP_PROTECTOR is used. We thank @Saiiijchan for their
|
||||||
|
contribution.
|
||||||
|
+ Add xPortResetHeapMinimumEverFreeHeapSize to heap_4.c and heap_5.c.
|
||||||
|
We thank @TomasGalbickaNXP for their contribution.
|
||||||
|
+ Add NULL check in the event_create function in the POSIX port. We thank
|
||||||
|
@laroche for their contribution.
|
||||||
|
+ Use _GNU_SOURCE macro instead of __USE_GNU in the Posix port. We thank
|
||||||
|
@maxiaogood for their contribution.
|
||||||
|
+ Use the new __ARM_FP macro instead of the deprectred __VFP_FP__ macro in
|
||||||
|
GCC/ARM_CM7, GCC/ARM_CM4_MPU, and GCC/ARM_CM4F ports. We thank @haydenridd
|
||||||
|
for their contribution.
|
||||||
|
+ Add portMEMORY_BARRIER definition to the Xtensa port. We thank @superroc
|
||||||
|
for their contribution.
|
||||||
|
+ Move the hardware include msp430.h to port.c from portmacro.h. We thank
|
||||||
|
@mayl for their contribution.
|
||||||
|
+ Update ARM assembly syntax for Cortex-M ports. We thank @laroche for their
|
||||||
|
contribution.
|
||||||
|
+ Update the Windows port to records a pending yield in
|
||||||
|
vPortCloseRunningThread to ensure that the next tick interrupt schedules
|
||||||
|
the next task regardless of the value of configUSE_PREEMPTION.
|
||||||
|
+ Fix the context switch issue in the RL78 port. We thank @KeitaKashima for
|
||||||
|
their contribution.
|
||||||
|
+ Fix compilation issue in ARM CM0 port when using Keil MDK. We thank
|
||||||
|
@TomasGalbickaNXP for their contribution.
|
||||||
|
+ Fix IA32 port compilation when configUSE_COMMON_INTERRUPT_ENTRY_POINT is
|
||||||
|
set to 0. We thank @Ryzee119 for their contribution.
|
||||||
|
+ Store configMTIMECMP_BASE_ADDRESS in a 64-bit integer for the RISC-V port.
|
||||||
|
We thank @vishwamartur for their contribution.
|
||||||
|
+ Fix nested interrupt handling and optimize FPU related context switching
|
||||||
|
for the F1Kx port. We thank @TrongNguyenR for their contribution.
|
||||||
|
+ Update the RP2040 port to add support for Raspberry Pi Pico SDK 2.0.0.
|
||||||
|
We thank @kilograham for their contribution.
|
||||||
|
+ Fix the return value of portYIELD_FROM_ISR macro for the MSVC-MingW port.
|
||||||
|
We thank @wwhheerree for their contribution.
|
||||||
|
+ Optimize vApplicationFPUSafeIRQHandler for the Coretex-A9 port by
|
||||||
|
removing the unnecessarily preserved callee saved registers. We thank
|
||||||
|
@Saiiijchan for their contribution.
|
||||||
|
+ Fix the context array size for MPU ports to ensure the saved context
|
||||||
|
location falls within the reserved context area rather than overlapping
|
||||||
|
with the next MPU_SETTINGS structure member.
|
||||||
|
+ Update CMake files for RP2040 port to fetch the port from the
|
||||||
|
Community-Supported-Ports repo. We thank @kilograham for their
|
||||||
|
contribution.
|
||||||
|
+ Fix CMake file for the GCC ARM_CM0 port to include MPU files. We thank
|
||||||
|
@0mhu for their contribution.
|
||||||
|
+ Add an example of human readable table generated by vTaskListTasks() in
|
||||||
|
the function documentation. We thank @wwhheerree for their contribution.
|
||||||
|
|
||||||
|
Changes between FreeRTOS V11.0.1 and FreeRTOS V11.1.0 released April 22, 2024
|
||||||
|
|
||||||
|
+ Add ARMv7-R port with Memory Protection Unit (MPU) support.
|
||||||
|
+ Add Memory Protection Unit (MPU) support to the Cortex-M0 port.
|
||||||
|
+ Add stream batching buffer. A stream batching buffer differs from a stream
|
||||||
|
buffer when a task reads from a non-empty buffer:
|
||||||
|
- The task reading from a non-empty stream buffer returns immediately
|
||||||
|
regardless of the amount of data in the buffer.
|
||||||
|
- The task reading from a non-empty steam batching buffer blocks until the
|
||||||
|
amount of data in the buffer exceeds the trigger level or the block time
|
||||||
|
expires.
|
||||||
|
We thank @cperkulator for their contribution.
|
||||||
|
+ Add the ability to change task notification index for stream buffers. We
|
||||||
|
thank @glemco for their contribution.
|
||||||
|
+ Add xStreamBufferResetFromISR and xMessageBufferResetFromISR APIs to reset
|
||||||
|
stream buffer and message buffer from an Interrupt Service Routine (ISR).
|
||||||
|
We thank @HagaiMoshe for their contribution.
|
||||||
|
+ Update all the FreeRTOS APIs to use configSTACK_DEPTH_TYPE for stack type.
|
||||||
|
We thank @feilipu for their contribution.
|
||||||
|
+ Update vTaskEndScheduler to delete the timer and idle tasks,
|
||||||
|
once the scheduler is stopped.
|
||||||
|
+ Make xTaskGetCurrentTaskHandleForCore() available to the single core
|
||||||
|
scheduler. We thank @Dazza0 for their contribution.
|
||||||
|
+ Update uxTaskGetSystemState to not use the pxIndex member of the List_t
|
||||||
|
structure while iterating ready tasks list. The reason is that pxIndex
|
||||||
|
member must only used to select next ready task to run. We thank
|
||||||
|
@gemarcano for their inputs.
|
||||||
|
+ Add a config option to the FreeRTOS SMP Kernel to set the default core
|
||||||
|
affinity mask for tasks created without an affinity mask. We thank @go2sh
|
||||||
|
for their contribution.
|
||||||
|
+ Add configUSE_EVENT_GROUPS and configUSE_STREAM_BUFFERS configuration
|
||||||
|
constants to control the inclusion of event group and stream buffer
|
||||||
|
functionalities.
|
||||||
|
+ Code changes to comply with MISRA C 2012.
|
||||||
|
+ Add 64-bit support to the FreeRTOS Windows Simulator port. We thank @watsk
|
||||||
|
and @josesimoes for their contributions.
|
||||||
|
+ Add support for 64-bit Microblaze processor to the MicroblazeV9 port. We
|
||||||
|
thank @mubinsyed for their contribution.
|
||||||
|
+ Add support for MSP430 Embedded Application Binary Interface (EABI) to
|
||||||
|
the MSP430F449 port to make it work with both MSP430 GCC and MSPGCC
|
||||||
|
compilers. We thank @Forty-Bot for their contribution.
|
||||||
|
+ Update xPortIsAuthorizedToAccessBuffer() on FreeRTOS ports with MPU
|
||||||
|
support to grant an unprivileged task access to all the memory before the
|
||||||
|
scheduler is started.
|
||||||
|
+ Update the POSIX port to pass the FreeRTOS task name to pthread for
|
||||||
|
readable output in debuggers. We thank @Mixaill for their contribution.
|
||||||
|
+ Update the POSIX port to ignore the user specified stack memory and only
|
||||||
|
pass the stack size to the pthread API to avoid errors caused when stack size
|
||||||
|
is smaller than the minimum. We thank @cmorgnaBE for their
|
||||||
|
contribution.
|
||||||
|
+ Update the POSIX port to use a timer thread for tick interrupts instead of
|
||||||
|
POSIX timers to address issues with signal handling in non-FreeRTOS
|
||||||
|
pthreads. We thank @cmorgnaBE for their contribution.
|
||||||
|
+ Update ARM_TFM port to support TF-Mv2.0.0 release of trusted-firmware-m.
|
||||||
|
We thanks @urutva for their contribution.
|
||||||
|
+ Remove redundant constant pools in ARMv8 ports. We thank @urutva for their
|
||||||
|
contribution.
|
||||||
|
+ Add APIs to reset the internal state of kernel modules. These APIs are
|
||||||
|
primarily intended to be used in the testing frameworks that restart the
|
||||||
|
scheduler.
|
||||||
|
+ Use kernel provided implementations of vApplicationGetIdleTaskMemory() and
|
||||||
|
vApplicationGetTimerTaskMemory() in the RP2040 port. We thank @dpslwk for
|
||||||
|
their contribution.
|
||||||
|
+ Fix atomic enter/exit critical section macro definitions in atomic.h for
|
||||||
|
ports that support nested interrupts. We thank @sebunger for their
|
||||||
|
contribution.
|
||||||
|
+ Fix compiler warnings in the MSP430F449 port when compiled with the
|
||||||
|
MSP430 GCC compiler. We thank @Forty-Bot for their contribution.
|
||||||
|
+ Update the scheduler suspension usage in ulTaskGenericNotifyTake and
|
||||||
|
xTaskGenericNotifyWait() to enhance code readability. We thank @Dazza0 for
|
||||||
|
their contribution.
|
||||||
|
+ Add support for latest version of MPU wrappers( mpu_wrappers_v2) in CMake.
|
||||||
|
We thank @IsaacDynamo for their contribution.
|
||||||
|
+ Update CMake support to create only one static library containing both the
|
||||||
|
kernel common code and the kernel port code. We thank @barnatahmed for
|
||||||
|
their contribution.
|
||||||
|
|
||||||
|
Changes between FreeRTOS V11.0.0 and FreeRTOS V11.0.1 released December 21, 2023
|
||||||
|
|
||||||
|
+ Updated the SBOM file.
|
||||||
|
|
||||||
|
Changes between FreeRTOS V10.6.2 and FreeRTOS V11.0.0 released December 18, 2023
|
||||||
|
|
||||||
|
+ SMP merged into the mainline: While FreeRTOS introduced Asymmetric
|
||||||
|
Multiprocessing (AMP) support in 2017, FreeRTOS Version 11.0.0 is the
|
||||||
|
first to merge Symmetric Multiprocessing (SMP) support into the mainline
|
||||||
|
release. SMP enables one instance of the FreeRTOS Kernel to schedule tasks
|
||||||
|
across multiple identical processor cores. We thank Mike Bruno and Jerry
|
||||||
|
McCarthy of XMOS and, Darian Liang, Sudeep Mohanty and Zim Kalinowski of
|
||||||
|
Espressif Systems for their contributions.
|
||||||
|
+ Switch MISRA compliance checking from PC Lint to Coverity, and update from
|
||||||
|
MISRA C:2004 to MISRA C:2012.
|
||||||
|
+ Add a template FreeRTOSConfig.h, inclusive of an abbreviated explanation of
|
||||||
|
each configuration item. Application writers can use this template as a
|
||||||
|
starting point to create the FreeRTOSConfig.h file for their application.
|
||||||
|
+ Add a template FreeRTOS port which can be used as a starting point for
|
||||||
|
developing a new FreeRTOS port.
|
||||||
|
+ Add bounds checking and obfuscation to internal heap block pointers in
|
||||||
|
heap_4.c and heap_5.c to help catch pointer corruptions. The application can
|
||||||
|
enable these checks by setting configENABLE_HEAP_PROTECTOR to 1 in their
|
||||||
|
FreeRTOSConfig.h. We thank @oliverlavery for their contribution.
|
||||||
|
+ Update vTaskList and vTaskGetRunTimeStats APIs to replace the use of sprintf
|
||||||
|
with snprintf.
|
||||||
|
+ Add trace macros to ports that enable tracing the interaction of ISRs with
|
||||||
|
scheduler events. We thank @conara for their contribution.
|
||||||
|
+ Add trace macros that enable tracing of entering and exiting all APIs. We
|
||||||
|
thank @Techcore123 for their contribution.
|
||||||
|
+ Add uxTaskBasePriorityGet and uxTaskBasePriorityGetFromISR APIs to get the
|
||||||
|
base priority of a task. The base priority of a task is the priority that
|
||||||
|
was last assigned to the task - which due to priority inheritance, may not
|
||||||
|
be the current priority of the task.
|
||||||
|
+ Add pdTICKS_TO_MS macro to convert time in FreeRTOS ticks to time in
|
||||||
|
milliseconds. We thank @Dazza0 for their contribution.
|
||||||
|
+ Add default implementations of vApplicationGetIdleTaskMemory and
|
||||||
|
vApplicationGetTimerTaskMemory. The application can enable these default
|
||||||
|
implementations by setting configKERNEL_PROVIDED_STATIC_MEMORY to 1 in their
|
||||||
|
FreeRTOSConfig.h. We thank @mdnr-g for their contribution.
|
||||||
|
+ Update vTaskGetInfo to include start and end of the stack whenever both
|
||||||
|
values are available. We thank @vinceburns for their contribution.
|
||||||
|
+ Prevent tasks waiting for a notification from being resumed by calls to
|
||||||
|
vTaskResume or vTaskResumeFromISR. We thank @Moral-Hao for their
|
||||||
|
contribution.
|
||||||
|
+ Add asserts to validate that the application has correctly installed
|
||||||
|
FreeRTOS handlers for PendSV and SVCall interrupts on Cortex-M devices.
|
||||||
|
We thank @jefftenney for their contribution.
|
||||||
|
+ Rename ARM_CA53_64_BIT and ARM_CA53_64_BIT_SRE ports to Arm_AARCH64 and
|
||||||
|
Arm_AARCH64_SRE respectively as these ports are applicable to all AArch64
|
||||||
|
architecture. We thank @urutva for their contribution.
|
||||||
|
+ Add CMake support to allow the application writer to select the RISC-V
|
||||||
|
chip extension. We thank @JoeBenczarski for their contribution.
|
||||||
|
+ Add CMake support to allow the application writer to build an application
|
||||||
|
with static allocation only. We thank @conara for their contribution.
|
||||||
|
+ Make taskYIELD available to unprivileged tasks for ARMv8-M ports.
|
||||||
|
+ Update Cortex-M23 ports to not use PSPLIM_NS. We thank @urutva for their
|
||||||
|
contribution.
|
||||||
|
+ Update the SysTick setup code for ARMv8-M ports to first configure the clock
|
||||||
|
source and then enable SysTick. This is needed to address a bug in QEMU
|
||||||
|
versions older than 7.0.0, which causes an emulation error if SysTick is
|
||||||
|
enabled without first selecting a valid clock source. We thank @jefftenney
|
||||||
|
for their contribution.
|
||||||
|
+ Add the port-optimized task selection algorithm optionally available for
|
||||||
|
ARMv7-M ports to the ARMv8-M ports. We thank @jefftenney for their
|
||||||
|
contribution.
|
||||||
|
+ Improve the speed of pvPortMalloc in heap_4.c and heap_5.c by removing
|
||||||
|
unnecessary steps while splitting a large memory block into two. We thank
|
||||||
|
@Moral-Hao for their contribution.
|
||||||
|
+ Shorten the critical section in pvPortMalloc in heap_2.c, heap_4.c and
|
||||||
|
heap_5.c by moving the size calculation out of the critical section. We thank
|
||||||
|
@Moral-Hao for their contribution.
|
||||||
|
+ Update xTaskNotifyWait and ulTaskNotifyTake to remove the non-deterministic
|
||||||
|
operation of traversing a linked link from a critical section. We thank
|
||||||
|
@karver8 for their contribution.
|
||||||
|
+ Fix stack end and stack size computation in POSIX port to meet the stack
|
||||||
|
alignment requirements on MacOS. We thank @tegimeki for their contribution.
|
||||||
|
+ Update the vTaskPrioritySet implementation to use the new priority when the
|
||||||
|
task has inherited priority from a mutex it is holding, and the new priority
|
||||||
|
is bigger than the inherited priority. We thank @Moral-Hao for their
|
||||||
|
contribution.
|
||||||
|
+ Add stack alignment adjustment if stack grows upwards. We thank @ivq for
|
||||||
|
their contribution.
|
||||||
|
+ Fix pxTopOfStack calculation in configINIT_TLS_BLOCK when picolib C is
|
||||||
|
selected as the C library implementation to ensure that
|
||||||
|
pxPortInitialiseStack does not overwrite the data in the TLS block portion
|
||||||
|
of the stack. We thank @bebebib-rs for their contribution.
|
||||||
|
+ Fix vPortEndScheduler() for the MSVC port so that the function
|
||||||
|
prvProcessSimulatedInterrupts is not stuck in an infinite loop when the
|
||||||
|
scheduler is stopped. We thank @Ju1He1 for their contribution.
|
||||||
|
+ Add the Pull Request (PR) Process explaining the stages a PR goes through.
|
||||||
|
|
||||||
|
Changes between FreeRTOS V10.6.1 and FreeRTOS V10.6.2 released November 29, 2023
|
||||||
|
|
||||||
|
+ Add the following improvements to the new MPU wrapper (mpu_wrappers_v2.c)
|
||||||
|
introduced in version 10.6.0:
|
||||||
|
- Introduce Access Control List (ACL) feature to allow the application
|
||||||
|
writer to control an unprivileged task’s access to kernel objects.
|
||||||
|
- Update the system call entry mechanism to only require one Supervisor
|
||||||
|
Call (SVC) instruction.
|
||||||
|
- Wrap parameters for system calls with more than four parameters in a
|
||||||
|
struct to avoid special handling during system call entry.
|
||||||
|
- Fix 2 possible integer overflows.
|
||||||
|
- Convert some asserts to run time parameter checks.
|
||||||
|
|
||||||
|
Changes between FreeRTOS V10.6.0 and FreeRTOS V10.6.1 released August 17, 2023
|
||||||
|
|
||||||
|
+ Add runtime parameter checks to functions in mpu_wrappers_v2.c file.
|
||||||
|
The same checks are already performed in API implementations using
|
||||||
|
asserts.
|
||||||
|
We thank the following people for their inputs in these changes:
|
||||||
|
- Lan Luo, Zixia Liu of School of Computer Science and Technology,
|
||||||
|
Anhui University of Technology, China.
|
||||||
|
- Xinwen Fu of Department of Computer Science, University of
|
||||||
|
Massachusetts Lowell, USA.
|
||||||
|
- Xinhui Shao, Yumeng Wei, Huaiyu Yan, Zhen Ling of School of
|
||||||
|
Computer Science and Engineering, Southeast University, China.
|
||||||
|
|
||||||
Changes between FreeRTOS V10.5.1 and FreeRTOS 10.6.0 released July 13, 2023
|
Changes between FreeRTOS V10.5.1 and FreeRTOS 10.6.0 released July 13, 2023
|
||||||
|
|
||||||
+ Add a new MPU wrapper that places additional restrictions on unprivileged
|
+ Add a new MPU wrapper that places additional restrictions on unprivileged
|
||||||
|
@ -61,8 +391,8 @@ Changes between FreeRTOS V10.5.1 and FreeRTOS 10.6.0 released July 13, 2023
|
||||||
China.
|
China.
|
||||||
- Xinwen Fu of Department of Computer Science, University of
|
- Xinwen Fu of Department of Computer Science, University of
|
||||||
Massachusetts Lowell, USA.
|
Massachusetts Lowell, USA.
|
||||||
- Yuequi Chen, Zicheng Wang, Minghao Lin of University of Colorado
|
- Yueqi Chen, Zicheng Wang, Minghao Lin, Jiahe Wang of University of
|
||||||
Boulder, USA.
|
Colorado Boulder, USA.
|
||||||
+ Add Cortex-M35P port. Contributed by @urutva.
|
+ Add Cortex-M35P port. Contributed by @urutva.
|
||||||
+ Add embedded extension (RV32E) support to the IAR RISC-V port.
|
+ Add embedded extension (RV32E) support to the IAR RISC-V port.
|
||||||
+ Add ulTaskGetRunTimeCounter and ulTaskGetRunTimePercent APIs. Contributed by
|
+ Add ulTaskGetRunTimeCounter and ulTaskGetRunTimePercent APIs. Contributed by
|
||||||
|
@ -333,7 +663,7 @@ Changes between FreeRTOS V10.4.3 and FreeRTOS V10.4.4 released May 28 2021
|
||||||
in more files.
|
in more files.
|
||||||
+ Other minor updates include adding additional configASSERT() checks and
|
+ Other minor updates include adding additional configASSERT() checks and
|
||||||
correcting and improving code comments.
|
correcting and improving code comments.
|
||||||
+ Go look at the smp branch to see the progress towards the Symetric
|
+ Go look at the smp branch to see the progress towards the Symmetric
|
||||||
Multiprocessing Kernel. https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/smp
|
Multiprocessing Kernel. https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/smp
|
||||||
|
|
||||||
Changes between FreeRTOS V10.4.2 and FreeRTOS V10.4.3 released December 14 2020
|
Changes between FreeRTOS V10.4.2 and FreeRTOS V10.4.3 released December 14 2020
|
||||||
|
@ -1820,7 +2150,7 @@ Changes between V6.1.0 and V6.1.1 released January 14 2011
|
||||||
Embedded Workbench.
|
Embedded Workbench.
|
||||||
+ Added a new port for the MSP430X core using the IAR Embedded Workbench.
|
+ Added a new port for the MSP430X core using the IAR Embedded Workbench.
|
||||||
+ Updated all the RX62N demo projects that target the Renesas Demonstration
|
+ Updated all the RX62N demo projects that target the Renesas Demonstration
|
||||||
Kit (RDK) to take into account the revered LED wiring on later hardware
|
Kit (RDK) to take into account the reversed LED wiring on later hardware
|
||||||
revisions, and the new J-Link debug interface DLL.
|
revisions, and the new J-Link debug interface DLL.
|
||||||
+ Updated all the RX62N demo projects so the IO page served by the example
|
+ Updated all the RX62N demo projects so the IO page served by the example
|
||||||
embedded web server works with all web browsers.
|
embedded web server works with all web browsers.
|
||||||
|
@ -2979,7 +3309,7 @@ Changes between V1.2.3 and V1.2.4
|
||||||
xSerialPortInitMinimal() and the function xPortInit() has been renamed
|
xSerialPortInitMinimal() and the function xPortInit() has been renamed
|
||||||
to xSerialPortInit().
|
to xSerialPortInit().
|
||||||
+ The function sSerialPutChar() has been renamed cSerialPutChar() and
|
+ The function sSerialPutChar() has been renamed cSerialPutChar() and
|
||||||
the function return type chaned to portCHAR.
|
the function return type changed to portCHAR.
|
||||||
+ The integer and flop tasks now include calls to tskYIELD(), allowing
|
+ The integer and flop tasks now include calls to tskYIELD(), allowing
|
||||||
them to be used with the cooperative scheduler.
|
them to be used with the cooperative scheduler.
|
||||||
+ All the demo applications now use the integer and comtest tasks when the
|
+ All the demo applications now use the integer and comtest tasks when the
|
||||||
|
@ -3113,7 +3443,7 @@ Changes between V1.01 and V1.2.0
|
||||||
ports to allocate a different maximum number of priorities.
|
ports to allocate a different maximum number of priorities.
|
||||||
+ By default the trace facility is off, previously USE_TRACE_FACILITY
|
+ By default the trace facility is off, previously USE_TRACE_FACILITY
|
||||||
was defined.
|
was defined.
|
||||||
+ comtest.c now uses a psuedo random delay between sends. This allows for
|
+ comtest.c now uses a pseudo random delay between sends. This allows for
|
||||||
better testing as the interrupts do not arrive at regular intervals.
|
better testing as the interrupts do not arrive at regular intervals.
|
||||||
+ Minor change to the Flashlite serial port driver. The driver is written
|
+ Minor change to the Flashlite serial port driver. The driver is written
|
||||||
to demonstrate the scheduler and is not written to be efficient.
|
to demonstrate the scheduler and is not written to be efficient.
|
||||||
|
|
145
MISRA.md
Normal file
145
MISRA.md
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
# MISRA Compliance
|
||||||
|
|
||||||
|
FreeRTOS-Kernel conforms to [MISRA C:2012](https://www.misra.org.uk/misra-c)
|
||||||
|
guidelines, with the deviations listed below. Compliance is checked with
|
||||||
|
Coverity static analysis version 2023.6.1. Since the FreeRTOS kernel is
|
||||||
|
designed for small-embedded devices, it needs to have a very small memory
|
||||||
|
footprint and has to be efficient. To achieve that and to increase the
|
||||||
|
performance, it deviates from some MISRA rules. The specific deviations,
|
||||||
|
suppressed inline, are listed below.
|
||||||
|
|
||||||
|
Additionally, [MISRA configuration file](examples/coverity/coverity_misra.config)
|
||||||
|
contains project wide deviations.
|
||||||
|
|
||||||
|
### Suppressed with Coverity Comments
|
||||||
|
To find the violation references in the source files run grep on the source code
|
||||||
|
with ( Assuming rule 8.4 violation; with justification in point 1 ):
|
||||||
|
```
|
||||||
|
grep 'MISRA Ref 8.4.1' . -rI
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Dir 4.7
|
||||||
|
MISRA C:2012 Dir 4.7: If a function returns error information, then that error
|
||||||
|
information shall be tested.
|
||||||
|
|
||||||
|
_Ref 4.7.1_
|
||||||
|
- `taskENTER_CRITICAL_FROM_ISR` returns the interrupt mask and not any error
|
||||||
|
information. Therefore, there is no need test the return value.
|
||||||
|
|
||||||
|
#### Rule 8.4
|
||||||
|
|
||||||
|
MISRA C:2012 Rule 8.4: A compatible declaration shall be visible when an
|
||||||
|
object or function with external linkage is defined.
|
||||||
|
|
||||||
|
_Ref 8.4.1_
|
||||||
|
- pxCurrentTCB(s) is defined with external linkage but it is only referenced
|
||||||
|
from the assembly code in the port files. Therefore, adding a declaration in
|
||||||
|
header file is not useful as the assembly code will still need to declare it
|
||||||
|
separately.
|
||||||
|
|
||||||
|
_Ref 8.4.2_
|
||||||
|
- xQueueRegistry is defined with external linkage because it is accessed by the
|
||||||
|
kernel unit tests. It is not meant to be directly accessed by the application
|
||||||
|
and therefore, not declared in a header file.
|
||||||
|
|
||||||
|
#### Rule 8.6
|
||||||
|
|
||||||
|
MISRA C:2012 Rule 8.6: An identifier with external linkage shall have exactly
|
||||||
|
one external definition.
|
||||||
|
|
||||||
|
_Ref 8.6.1_
|
||||||
|
- This rule prohibits an identifier with external linkage to have multiple
|
||||||
|
definitions or no definition. FreeRTOS hook functions are implemented in
|
||||||
|
the application and therefore, have no definition in the Kernel code.
|
||||||
|
|
||||||
|
#### Rule 11.1
|
||||||
|
MISRA C:2012 Rule 11.1: Conversions shall not be performed between a pointer to
|
||||||
|
function and any other type.
|
||||||
|
|
||||||
|
_Ref 11.1.1_
|
||||||
|
- The pointer to function is casted into void to avoid unused parameter
|
||||||
|
compiler warning when Stream Buffer's Tx and Rx Completed callback feature is
|
||||||
|
not used.
|
||||||
|
|
||||||
|
#### Rule 11.3
|
||||||
|
|
||||||
|
MISRA C:2012 Rule 11.3: A cast shall not be performed between a pointer to
|
||||||
|
object type and a pointer to a different object type.
|
||||||
|
|
||||||
|
_Ref 11.3.1_
|
||||||
|
- This rule prohibits casting a pointer to object into a pointer to a
|
||||||
|
different object because it may result in an incorrectly aligned pointer,
|
||||||
|
leading to undefined behavior. Even if the casting produces a correctly
|
||||||
|
aligned pointer, the behavior may be still undefined if the pointer is
|
||||||
|
used to access an object. FreeRTOS deliberately creates external aliases
|
||||||
|
for all the kernel object types (StaticEventGroup_t, StaticQueue_t,
|
||||||
|
StaticStreamBuffer_t, StaticTimer_t and StaticTask_t) for data hiding
|
||||||
|
purposes. The internal object types and the corresponding external
|
||||||
|
aliases are guaranteed to have the same size and alignment which is
|
||||||
|
checked using configASSERT.
|
||||||
|
|
||||||
|
|
||||||
|
#### Rule 11.5
|
||||||
|
|
||||||
|
MISRA C:2012 Rule 11.5: A conversion should not be performed from pointer to
|
||||||
|
void into pointer to object.
|
||||||
|
This rule prohibits conversion of a pointer to void into a pointer to
|
||||||
|
object because it may result in an incorrectly aligned pointer leading
|
||||||
|
to undefined behavior.
|
||||||
|
|
||||||
|
_Ref 11.5.1_
|
||||||
|
- The memory blocks returned by pvPortMalloc() are guaranteed to meet the
|
||||||
|
architecture alignment requirements specified by portBYTE_ALIGNMENT.
|
||||||
|
The casting of the pointer to void returned by pvPortMalloc() is,
|
||||||
|
therefore, safe because it is guaranteed to be aligned.
|
||||||
|
|
||||||
|
_Ref 11.5.2_
|
||||||
|
- The conversion from a pointer to void into a pointer to EventGroup_t is
|
||||||
|
safe because it is a pointer to EventGroup_t, which is returned to the
|
||||||
|
application at the time of event group creation for data hiding
|
||||||
|
purposes.
|
||||||
|
|
||||||
|
_Ref 11.5.3_
|
||||||
|
- The conversion from a pointer to void in list macros for list item owner
|
||||||
|
is safe because the type of the pointer stored and retrieved is the
|
||||||
|
same.
|
||||||
|
|
||||||
|
_Ref 11.5.4_
|
||||||
|
- The conversion from a pointer to void into a pointer to EventGroup_t is
|
||||||
|
safe because it is a pointer to EventGroup_t, which is passed as a
|
||||||
|
parameter to the xTimerPendFunctionCallFromISR API when the callback is
|
||||||
|
pended.
|
||||||
|
|
||||||
|
_Ref 11.5.5_
|
||||||
|
- The conversion from a pointer to void into a pointer to uint8_t is safe
|
||||||
|
because data storage buffers are implemented as uint8_t arrays for the
|
||||||
|
ease of sizing, alignment and access.
|
||||||
|
|
||||||
|
#### Rule 14.3
|
||||||
|
|
||||||
|
MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant.
|
||||||
|
|
||||||
|
_Ref 14.3_
|
||||||
|
- The `configMAX_TASK_NAME_LEN` , `taskRESERVED_TASK_NAME_LENGTH` and `SIZE_MAX`
|
||||||
|
are evaluated to constants at compile time and may vary based on the build
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
#### Rule 18.1
|
||||||
|
|
||||||
|
MISRA C-2012 Rule 18.1: A pointer resulting from arithmetic on a pointer operand
|
||||||
|
shall address an element of the same array as that pointer operand.
|
||||||
|
|
||||||
|
_Ref 18.1_
|
||||||
|
- Array access remains within bounds since either the null terminator in
|
||||||
|
the IDLE task name will break the loop, or the loop will break normally
|
||||||
|
if the array size is smaller than the IDLE task name length.
|
||||||
|
|
||||||
|
#### Rule 21.6
|
||||||
|
|
||||||
|
MISRA C-2012 Rule 21.6: The Standard Library input/output functions shall not
|
||||||
|
be used.
|
||||||
|
|
||||||
|
_Ref 21.6.1_
|
||||||
|
- The Standard Library function snprintf is used in vTaskListTasks and
|
||||||
|
vTaskGetRunTimeStatistics APIs, both of which are utility functions only and
|
||||||
|
are not considered part of core kernel implementation.
|
114
README.md
114
README.md
|
@ -1,18 +1,45 @@
|
||||||
[](https://github.com/FreeRTOS/FreeRTOS-Kernel/actions/workflows/unit-tests.yml?query=branch%3Amain+event%3Apush+workflow%3A%22CMock+Unit+Tests%22++)
|
[](https://github.com/FreeRTOS/FreeRTOS-Kernel/actions/workflows/unit-tests.yml?query=branch%3Amain+event%3Apush+workflow%3A%22CMock+Unit+Tests%22++)
|
||||||
[](https://codecov.io/gh/FreeRTOS/FreeRTOS-Kernel)
|
[](https://codecov.io/gh/FreeRTOS/FreeRTOS-Kernel)
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
This repository contains FreeRTOS kernel source/header files and kernel ports only. This repository is referenced as a submodule in [FreeRTOS/FreeRTOS](https://github.com/FreeRTOS/FreeRTOS) repository, which contains pre-configured demo application projects under ```FreeRTOS/Demo``` directory.
|
|
||||||
|
|
||||||
The easiest way to use FreeRTOS is to start with one of the pre-configured demo application projects. That way you will have the correct FreeRTOS source files included, and the correct include paths configured. Once a demo application is building and executing you can remove the demo application files, and start to add in your own application source files. See the [FreeRTOS Kernel Quick Start Guide](https://www.FreeRTOS.org/FreeRTOS-quick-start-guide.html) for detailed instructions and other useful links.
|
This repository contains FreeRTOS kernel source/header files and kernel
|
||||||
|
ports only. This repository is referenced as a submodule in
|
||||||
|
[FreeRTOS/FreeRTOS](https://github.com/FreeRTOS/FreeRTOS)
|
||||||
|
repository, which contains pre-configured demo application projects under
|
||||||
|
```FreeRTOS/Demo``` directory.
|
||||||
|
|
||||||
Additionally, for FreeRTOS kernel feature information refer to the [Developer Documentation](https://www.FreeRTOS.org/features.html), and [API Reference](https://www.FreeRTOS.org/a00106.html).
|
The easiest way to use FreeRTOS is to start with one of the pre-configured demo
|
||||||
|
application projects. That way you will have the correct FreeRTOS source files
|
||||||
|
included, and the correct include paths configured. Once a demo application is
|
||||||
|
building and executing you can remove the demo application files, and start to
|
||||||
|
add in your own application source files. See the
|
||||||
|
[FreeRTOS Kernel Quick Start Guide](https://www.freertos.org/Documentation/01-FreeRTOS-quick-start/01-Beginners-guide/02-Quick-start-guide)
|
||||||
|
for detailed instructions and other useful links.
|
||||||
|
|
||||||
|
Additionally, for FreeRTOS kernel feature information refer to the
|
||||||
|
[Developer Documentation](https://www.freertos.org/Documentation/02-Kernel/02-Kernel-features/00-Developer-docs),
|
||||||
|
and [API Reference](https://www.freertos.org/Documentation/02-Kernel/04-API-references/01-Task-creation/00-TaskHandle).
|
||||||
|
|
||||||
|
Also for contributing and creating a Pull Request please refer to
|
||||||
|
[the instructions here](.github/CONTRIBUTING.md#contributing-via-pull-request).
|
||||||
|
|
||||||
|
**FreeRTOS-Kernel V11.1.0
|
||||||
|
[source code](https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/V11.1.0) is part
|
||||||
|
of the
|
||||||
|
[FreeRTOS 202406.00 LTS](https://github.com/FreeRTOS/FreeRTOS-LTS/tree/202406-LTS)
|
||||||
|
release.**
|
||||||
|
|
||||||
### Getting help
|
### Getting help
|
||||||
If you have any questions or need assistance troubleshooting your FreeRTOS project, we have an active community that can help on the [FreeRTOS Community Support Forum](https://forums.freertos.org).
|
|
||||||
|
If you have any questions or need assistance troubleshooting your FreeRTOS project,
|
||||||
|
we have an active community that can help on the
|
||||||
|
[FreeRTOS Community Support Forum](https://forums.freertos.org).
|
||||||
|
|
||||||
## To consume FreeRTOS-Kernel
|
## To consume FreeRTOS-Kernel
|
||||||
|
|
||||||
### Consume with CMake
|
### Consume with CMake
|
||||||
|
|
||||||
If using CMake, it is recommended to use this repository using FetchContent.
|
If using CMake, it is recommended to use this repository using FetchContent.
|
||||||
Add the following into your project's main or a subdirectory's `CMakeLists.txt`:
|
Add the following into your project's main or a subdirectory's `CMakeLists.txt`:
|
||||||
|
|
||||||
|
@ -25,8 +52,16 @@ FetchContent_Declare( freertos_kernel
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In case you prefer to add it as a git submodule, do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git submodule add https://github.com/FreeRTOS/FreeRTOS-Kernel.git <path of the submodule>
|
||||||
|
git submodule update --init
|
||||||
|
```
|
||||||
|
|
||||||
- Add a freertos_config library (typically an INTERFACE library) The following assumes the directory structure:
|
- Add a freertos_config library (typically an INTERFACE library) The following assumes the directory structure:
|
||||||
- `include/FreeRTOSConfig.h`
|
- `include/FreeRTOSConfig.h`
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
add_library(freertos_config INTERFACE)
|
add_library(freertos_config INTERFACE)
|
||||||
|
|
||||||
|
@ -41,6 +76,12 @@ target_compile_definitions(freertos_config
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In case you installed FreeRTOS-Kernel as a submodule, you will have to add it as a subdirectory:
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
add_subdirectory(${FREERTOS_PATH})
|
||||||
|
```
|
||||||
|
|
||||||
- Configure the FreeRTOS-Kernel and make it available
|
- Configure the FreeRTOS-Kernel and make it available
|
||||||
- this particular example supports a native and cross-compiled build option.
|
- this particular example supports a native and cross-compiled build option.
|
||||||
|
|
||||||
|
@ -56,18 +97,29 @@ endif()
|
||||||
FetchContent_MakeAvailable(freertos_kernel)
|
FetchContent_MakeAvailable(freertos_kernel)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- In case of cross compilation, you should also add the following to `freertos_config`:
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
target_compile_definitions(freertos_config INTERFACE ${definitions})
|
||||||
|
target_compile_options(freertos_config INTERFACE ${options})
|
||||||
|
```
|
||||||
|
|
||||||
### Consuming stand-alone - Cloning this repository
|
### Consuming stand-alone - Cloning this repository
|
||||||
|
|
||||||
To clone using HTTPS:
|
To clone using HTTPS:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/FreeRTOS/FreeRTOS-Kernel.git
|
git clone https://github.com/FreeRTOS/FreeRTOS-Kernel.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Using SSH:
|
Using SSH:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone git@github.com:FreeRTOS/FreeRTOS-Kernel.git
|
git clone git@github.com:FreeRTOS/FreeRTOS-Kernel.git
|
||||||
```
|
```
|
||||||
|
|
||||||
## Repository structure
|
## Repository structure
|
||||||
|
|
||||||
- The root of this repository contains the three files that are common to
|
- The root of this repository contains the three files that are common to
|
||||||
every port - list.c, queue.c and tasks.c. The kernel is contained within these
|
every port - list.c, queue.c and tasks.c. The kernel is contained within these
|
||||||
three files. croutine.c implements the optional co-routine functionality - which
|
three files. croutine.c implements the optional co-routine functionality - which
|
||||||
|
@ -78,23 +130,63 @@ See the readme file in the ```./portable``` directory for more information.
|
||||||
|
|
||||||
- The ```./include``` directory contains the real time kernel header files.
|
- The ```./include``` directory contains the real time kernel header files.
|
||||||
|
|
||||||
|
- The ```./template_configuration``` directory contains a sample `FreeRTOSConfig.h` to help jumpstart a new project.
|
||||||
|
See the [FreeRTOSConfig.h](examples/template_configuration/FreeRTOSConfig.h) file for instructions.
|
||||||
|
|
||||||
### Code Formatting
|
### Code Formatting
|
||||||
FreeRTOS files are formatted using the "uncrustify" tool. The configuration file used by uncrustify can be found in the [.github/uncrustify.cfg](.github/uncrustify.cfg) file.
|
|
||||||
|
FreeRTOS files are formatted using the
|
||||||
|
"[uncrustify](https://github.com/uncrustify/uncrustify)" tool.
|
||||||
|
The configuration file used by uncrustify can be found in the
|
||||||
|
[FreeRTOS/CI-CD-GitHub-Actions's](https://github.com/FreeRTOS/CI-CD-Github-Actions)
|
||||||
|
[uncrustify.cfg](https://github.com/FreeRTOS/CI-CD-Github-Actions/tree/main/formatting)
|
||||||
|
file.
|
||||||
|
|
||||||
### Line Endings
|
### Line Endings
|
||||||
File checked into the FreeRTOS-Kernel repository use unix-style LF line endings for the best compatbility with git.
|
|
||||||
|
|
||||||
For optmial compatibility with Microsoft Windows tools, it is best to enable the git autocrlf feature. You can eanble this setting for the current repository using the following command:
|
File checked into the FreeRTOS-Kernel repository use unix-style LF line endings
|
||||||
|
for the best compatibility with git.
|
||||||
|
|
||||||
|
For optimal compatibility with Microsoft Windows tools, it is best to enable
|
||||||
|
the git autocrlf feature. You can enable this setting for the current
|
||||||
|
repository using the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
git config core.autocrlf true
|
git config core.autocrlf true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Git History Optimizations
|
### Git History Optimizations
|
||||||
Some commits in this repository perform large refactors which touch many lines and lead to unwanted behavior when using the `git blame` command. You can configure git to ignore the list of large refactor commits in this repository with the followig command:
|
|
||||||
|
Some commits in this repository perform large refactors which touch many lines
|
||||||
|
and lead to unwanted behavior when using the `git blame` command. You can
|
||||||
|
configure git to ignore the list of large refactor commits in this repository
|
||||||
|
with the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
git config blame.ignoreRevsFile .git-blame-ignore-revs
|
git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||||
```
|
```
|
||||||
|
|
||||||
### Spelling
|
### Spelling and Formatting
|
||||||
*lexicon.txt* contains words that are not traditionally found in an English dictionary. It is used by the spellchecker to verify the various jargon, variable names, and other odd words used in the FreeRTOS code base. If your pull request fails to pass the spelling and you believe this is a mistake, then add the word to *lexicon.txt*.
|
|
||||||
Note that only the FreeRTOS Kernel source files are checked for proper spelling, the portable section is ignored.
|
We recommend using [Visual Studio Code](https://code.visualstudio.com),
|
||||||
|
commonly referred to as VSCode, when working on the FreeRTOS-Kernel.
|
||||||
|
The FreeRTOS-Kernel also uses [cSpell](https://cspell.org/) as part of its
|
||||||
|
spelling check. The config file for which can be found at [cspell.config.yaml](cspell.config.yaml)
|
||||||
|
There is additionally a
|
||||||
|
[cSpell plugin for VSCode](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
|
||||||
|
that can be used as well.
|
||||||
|
*[.cSpellWords.txt](.github/.cSpellWords.txt)* contains words that are not
|
||||||
|
traditionally found in an English dictionary. It is used by the spellchecker
|
||||||
|
to verify the various jargon, variable names, and other odd words used in the
|
||||||
|
FreeRTOS code base are correct. If your pull request fails to pass the spelling
|
||||||
|
and you believe this is a mistake, then add the word to
|
||||||
|
*[.cSpellWords.txt](.github/.cSpellWords.txt)*. When adding a word please
|
||||||
|
then sort the list, which can be done by running the bash command:
|
||||||
|
`sort -u .cSpellWords.txt -o .cSpellWords.txt`
|
||||||
|
Note that only the FreeRTOS-Kernel Source Files, [include](include),
|
||||||
|
[portable/MemMang](portable/MemMang), and [portable/Common](portable/Common)
|
||||||
|
files are checked for proper spelling, and formatting at this time.
|
||||||
|
|
||||||
|
## Third Party Tools
|
||||||
|
Visit [this link](.github/third_party_tools.md) for detailed information about
|
||||||
|
third-party tools with FreeRTOS support.
|
||||||
|
|
60
croutine.c
60
croutine.c
|
@ -30,7 +30,7 @@
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "croutine.h"
|
#include "croutine.h"
|
||||||
|
|
||||||
/* Remove the whole file is co-routines are not being used. */
|
/* Remove the whole file if co-routines are not being used. */
|
||||||
#if ( configUSE_CO_ROUTINES != 0 )
|
#if ( configUSE_CO_ROUTINES != 0 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,17 +43,19 @@
|
||||||
|
|
||||||
|
|
||||||
/* Lists for ready and blocked co-routines. --------------------*/
|
/* Lists for ready and blocked co-routines. --------------------*/
|
||||||
static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */
|
static List_t pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /**< Prioritised ready co-routines. */
|
||||||
static List_t xDelayedCoRoutineList1; /*< Delayed co-routines. */
|
static List_t xDelayedCoRoutineList1; /**< Delayed co-routines. */
|
||||||
static List_t xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
|
static List_t xDelayedCoRoutineList2; /**< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
|
||||||
static List_t * pxDelayedCoRoutineList = NULL; /*< Points to the delayed co-routine list currently being used. */
|
static List_t * pxDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list currently being used. */
|
||||||
static List_t * pxOverflowDelayedCoRoutineList = NULL; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
|
static List_t * pxOverflowDelayedCoRoutineList = NULL; /**< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
|
||||||
static List_t xPendingReadyCoRoutineList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */
|
static List_t xPendingReadyCoRoutineList; /**< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */
|
||||||
|
|
||||||
/* Other file private variables. --------------------------------*/
|
/* Other file private variables. --------------------------------*/
|
||||||
CRCB_t * pxCurrentCoRoutine = NULL;
|
CRCB_t * pxCurrentCoRoutine = NULL;
|
||||||
static UBaseType_t uxTopCoRoutineReadyPriority = 0;
|
static UBaseType_t uxTopCoRoutineReadyPriority = ( UBaseType_t ) 0U;
|
||||||
static TickType_t xCoRoutineTickCount = 0, xLastTickCount = 0, xPassedTicks = 0;
|
static TickType_t xCoRoutineTickCount = ( TickType_t ) 0U;
|
||||||
|
static TickType_t xLastTickCount = ( TickType_t ) 0U;
|
||||||
|
static TickType_t xPassedTicks = ( TickType_t ) 0U;
|
||||||
|
|
||||||
/* The initial state of the co-routine when it is created. */
|
/* The initial state of the co-routine when it is created. */
|
||||||
#define corINITIAL_STATE ( 0 )
|
#define corINITIAL_STATE ( 0 )
|
||||||
|
@ -107,7 +109,12 @@
|
||||||
BaseType_t xReturn;
|
BaseType_t xReturn;
|
||||||
CRCB_t * pxCoRoutine;
|
CRCB_t * pxCoRoutine;
|
||||||
|
|
||||||
|
traceENTER_xCoRoutineCreate( pxCoRoutineCode, uxPriority, uxIndex );
|
||||||
|
|
||||||
/* Allocate the memory that will store the co-routine control block. */
|
/* Allocate the memory that will store the co-routine control block. */
|
||||||
|
/* MISRA Ref 11.5.1 [Malloc memory assignment] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
||||||
|
/* coverity[misra_c_2012_rule_11_5_violation] */
|
||||||
pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) );
|
pxCoRoutine = ( CRCB_t * ) pvPortMalloc( sizeof( CRCB_t ) );
|
||||||
|
|
||||||
if( pxCoRoutine )
|
if( pxCoRoutine )
|
||||||
|
@ -156,6 +163,8 @@
|
||||||
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
traceRETURN_xCoRoutineCreate( xReturn );
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -165,6 +174,8 @@
|
||||||
{
|
{
|
||||||
TickType_t xTimeToWake;
|
TickType_t xTimeToWake;
|
||||||
|
|
||||||
|
traceENTER_vCoRoutineAddToDelayedList( xTicksToDelay, pxEventList );
|
||||||
|
|
||||||
/* Calculate the time to wake - this may overflow but this is
|
/* Calculate the time to wake - this may overflow but this is
|
||||||
* not a problem. */
|
* not a problem. */
|
||||||
xTimeToWake = xCoRoutineTickCount + xTicksToDelay;
|
xTimeToWake = xCoRoutineTickCount + xTicksToDelay;
|
||||||
|
@ -196,6 +207,8 @@
|
||||||
* function must be called with interrupts disabled. */
|
* function must be called with interrupts disabled. */
|
||||||
vListInsert( pxEventList, &( pxCurrentCoRoutine->xEventListItem ) );
|
vListInsert( pxEventList, &( pxCurrentCoRoutine->xEventListItem ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
traceRETURN_vCoRoutineAddToDelayedList();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -283,6 +296,8 @@
|
||||||
|
|
||||||
void vCoRoutineSchedule( void )
|
void vCoRoutineSchedule( void )
|
||||||
{
|
{
|
||||||
|
traceENTER_vCoRoutineSchedule();
|
||||||
|
|
||||||
/* Only run a co-routine after prvInitialiseCoRoutineLists() has been
|
/* Only run a co-routine after prvInitialiseCoRoutineLists() has been
|
||||||
* called. prvInitialiseCoRoutineLists() is called automatically when a
|
* called. prvInitialiseCoRoutineLists() is called automatically when a
|
||||||
* co-routine is created. */
|
* co-routine is created. */
|
||||||
|
@ -313,6 +328,8 @@
|
||||||
/* Call the co-routine. */
|
/* Call the co-routine. */
|
||||||
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
|
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
traceRETURN_vCoRoutineSchedule();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -341,6 +358,8 @@
|
||||||
CRCB_t * pxUnblockedCRCB;
|
CRCB_t * pxUnblockedCRCB;
|
||||||
BaseType_t xReturn;
|
BaseType_t xReturn;
|
||||||
|
|
||||||
|
traceENTER_xCoRoutineRemoveFromEventList( pxEventList );
|
||||||
|
|
||||||
/* This function is called from within an interrupt. It can only access
|
/* This function is called from within an interrupt. It can only access
|
||||||
* event lists and the pending ready list. This function assumes that a
|
* event lists and the pending ready list. This function assumes that a
|
||||||
* check has already been made to ensure pxEventList is not empty. */
|
* check has already been made to ensure pxEventList is not empty. */
|
||||||
|
@ -357,7 +376,30 @@
|
||||||
xReturn = pdFALSE;
|
xReturn = pdFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
traceRETURN_xCoRoutineRemoveFromEventList( xReturn );
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset state in this file. This state is normally initialized at start up.
|
||||||
|
* This function must be called by the application before restarting the
|
||||||
|
* scheduler.
|
||||||
|
*/
|
||||||
|
void vCoRoutineResetState( void )
|
||||||
|
{
|
||||||
|
/* Lists for ready and blocked co-routines. */
|
||||||
|
pxDelayedCoRoutineList = NULL;
|
||||||
|
pxOverflowDelayedCoRoutineList = NULL;
|
||||||
|
|
||||||
|
/* Other file private variables. */
|
||||||
|
pxCurrentCoRoutine = NULL;
|
||||||
|
uxTopCoRoutineReadyPriority = ( UBaseType_t ) 0U;
|
||||||
|
xCoRoutineTickCount = ( TickType_t ) 0U;
|
||||||
|
xLastTickCount = ( TickType_t ) 0U;
|
||||||
|
xPassedTicks = ( TickType_t ) 0U;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#endif /* configUSE_CO_ROUTINES == 0 */
|
#endif /* configUSE_CO_ROUTINES == 0 */
|
||||||
|
|
31
cspell.config.yaml
Normal file
31
cspell.config.yaml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
|
||||||
|
version: '0.2'
|
||||||
|
# Allows things like stringLength
|
||||||
|
allowCompoundWords: true
|
||||||
|
|
||||||
|
# Read files not to spell check from the git ignore
|
||||||
|
useGitignore: true
|
||||||
|
|
||||||
|
# Language settings for C
|
||||||
|
languageSettings:
|
||||||
|
- caseSensitive: false
|
||||||
|
enabled: true
|
||||||
|
languageId: c
|
||||||
|
locale: "*"
|
||||||
|
|
||||||
|
# Add a dictionary, and the path to the word list
|
||||||
|
dictionaryDefinitions:
|
||||||
|
- name: freertos-words
|
||||||
|
path: '.github/.cSpellWords.txt'
|
||||||
|
addWords: true
|
||||||
|
|
||||||
|
dictionaries:
|
||||||
|
- freertos-words
|
||||||
|
|
||||||
|
# Paths and files to ignore
|
||||||
|
ignorePaths:
|
||||||
|
- 'dependency'
|
||||||
|
- 'docs'
|
||||||
|
- 'ThirdParty'
|
||||||
|
- 'History.txt'
|
178
event_groups.c
178
event_groups.c
|
@ -40,31 +40,16 @@
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "event_groups.h"
|
#include "event_groups.h"
|
||||||
|
|
||||||
/* Lint e961, e750 and e9021 are suppressed as a MISRA exception justified
|
/* The MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined
|
||||||
* because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined
|
|
||||||
* for the header files above, but not in this file, in order to generate the
|
* for the header files above, but not in this file, in order to generate the
|
||||||
* correct privileged Vs unprivileged linkage and placement. */
|
* correct privileged Vs unprivileged linkage and placement. */
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021 See comment above. */
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
/* The following bit fields convey control information in a task's event list
|
/* This entire source file will be skipped if the application is not configured
|
||||||
* item value. It is important they don't clash with the
|
* to include event groups functionality. This #if is closed at the very bottom
|
||||||
* taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
|
* of this file. If you want to include event groups then ensure
|
||||||
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
|
* configUSE_EVENT_GROUPS is set to 1 in FreeRTOSConfig.h. */
|
||||||
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x0100U
|
#if ( configUSE_EVENT_GROUPS == 1 )
|
||||||
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x0200U
|
|
||||||
#define eventWAIT_FOR_ALL_BITS 0x0400U
|
|
||||||
#define eventEVENT_BITS_CONTROL_BYTES 0xff00U
|
|
||||||
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
|
|
||||||
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x01000000UL
|
|
||||||
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x02000000UL
|
|
||||||
#define eventWAIT_FOR_ALL_BITS 0x04000000UL
|
|
||||||
#define eventEVENT_BITS_CONTROL_BYTES 0xff000000UL
|
|
||||||
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
|
|
||||||
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x0100000000000000ULL
|
|
||||||
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x0200000000000000ULL
|
|
||||||
#define eventWAIT_FOR_ALL_BITS 0x0400000000000000ULL
|
|
||||||
#define eventEVENT_BITS_CONTROL_BYTES 0xff00000000000000ULL
|
|
||||||
#endif /* if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS ) */
|
|
||||||
|
|
||||||
typedef struct EventGroupDef_t
|
typedef struct EventGroupDef_t
|
||||||
{
|
{
|
||||||
|
@ -102,6 +87,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
{
|
{
|
||||||
EventGroup_t * pxEventBits;
|
EventGroup_t * pxEventBits;
|
||||||
|
|
||||||
|
traceENTER_xEventGroupCreateStatic( pxEventGroupBuffer );
|
||||||
|
|
||||||
/* A StaticEventGroup_t object must be provided. */
|
/* A StaticEventGroup_t object must be provided. */
|
||||||
configASSERT( pxEventGroupBuffer );
|
configASSERT( pxEventGroupBuffer );
|
||||||
|
|
||||||
|
@ -112,11 +99,14 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
* event group structure. */
|
* event group structure. */
|
||||||
volatile size_t xSize = sizeof( StaticEventGroup_t );
|
volatile size_t xSize = sizeof( StaticEventGroup_t );
|
||||||
configASSERT( xSize == sizeof( EventGroup_t ) );
|
configASSERT( xSize == sizeof( EventGroup_t ) );
|
||||||
} /*lint !e529 xSize is referenced if configASSERT() is defined. */
|
}
|
||||||
#endif /* configASSERT_DEFINED */
|
#endif /* configASSERT_DEFINED */
|
||||||
|
|
||||||
/* The user has provided a statically allocated event group - use it. */
|
/* The user has provided a statically allocated event group - use it. */
|
||||||
pxEventBits = ( EventGroup_t * ) pxEventGroupBuffer; /*lint !e740 !e9087 EventGroup_t and StaticEventGroup_t are deliberately aliased for data hiding purposes and guaranteed to have the same size and alignment requirement - checked by configASSERT(). */
|
/* MISRA Ref 11.3.1 [Misaligned access] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-113 */
|
||||||
|
/* coverity[misra_c_2012_rule_11_3_violation] */
|
||||||
|
pxEventBits = ( EventGroup_t * ) pxEventGroupBuffer;
|
||||||
|
|
||||||
if( pxEventBits != NULL )
|
if( pxEventBits != NULL )
|
||||||
{
|
{
|
||||||
|
@ -142,6 +132,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
traceEVENT_GROUP_CREATE_FAILED();
|
traceEVENT_GROUP_CREATE_FAILED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupCreateStatic( pxEventBits );
|
||||||
|
|
||||||
return pxEventBits;
|
return pxEventBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,20 +146,12 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
{
|
{
|
||||||
EventGroup_t * pxEventBits;
|
EventGroup_t * pxEventBits;
|
||||||
|
|
||||||
/* Allocate the event group. Justification for MISRA deviation as
|
traceENTER_xEventGroupCreate();
|
||||||
* follows: pvPortMalloc() always ensures returned memory blocks are
|
|
||||||
* aligned per the requirements of the MCU stack. In this case
|
/* MISRA Ref 11.5.1 [Malloc memory assignment] */
|
||||||
* pvPortMalloc() must return a pointer that is guaranteed to meet the
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
||||||
* alignment requirements of the EventGroup_t structure - which (if you
|
/* coverity[misra_c_2012_rule_11_5_violation] */
|
||||||
* follow it through) is the alignment requirements of the TickType_t type
|
pxEventBits = ( EventGroup_t * ) pvPortMalloc( sizeof( EventGroup_t ) );
|
||||||
* (EventBits_t being of TickType_t itself). Therefore, whenever the
|
|
||||||
* stack alignment requirements are greater than or equal to the
|
|
||||||
* TickType_t alignment requirements the cast is safe. In other cases,
|
|
||||||
* where the natural word size of the architecture is less than
|
|
||||||
* sizeof( TickType_t ), the TickType_t variables will be accessed in two
|
|
||||||
* or more reads operations, and the alignment requirements is only that
|
|
||||||
* of each individual read. */
|
|
||||||
pxEventBits = ( EventGroup_t * ) pvPortMalloc( sizeof( EventGroup_t ) ); /*lint !e9087 !e9079 see comment above. */
|
|
||||||
|
|
||||||
if( pxEventBits != NULL )
|
if( pxEventBits != NULL )
|
||||||
{
|
{
|
||||||
|
@ -187,9 +171,11 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
traceEVENT_GROUP_CREATE_FAILED(); /*lint !e9063 Else branch only exists to allow tracing and does not generate code if trace macros are not defined. */
|
traceEVENT_GROUP_CREATE_FAILED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupCreate( pxEventBits );
|
||||||
|
|
||||||
return pxEventBits;
|
return pxEventBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,6 +192,8 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||||
BaseType_t xAlreadyYielded;
|
BaseType_t xAlreadyYielded;
|
||||||
BaseType_t xTimeoutOccurred = pdFALSE;
|
BaseType_t xTimeoutOccurred = pdFALSE;
|
||||||
|
|
||||||
|
traceENTER_xEventGroupSync( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait );
|
||||||
|
|
||||||
configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
||||||
configASSERT( uxBitsToWaitFor != 0 );
|
configASSERT( uxBitsToWaitFor != 0 );
|
||||||
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
|
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
|
||||||
|
@ -263,7 +251,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||||
{
|
{
|
||||||
if( xAlreadyYielded == pdFALSE )
|
if( xAlreadyYielded == pdFALSE )
|
||||||
{
|
{
|
||||||
portYIELD_WITHIN_API();
|
taskYIELD_WITHIN_API();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -315,6 +303,8 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||||
/* Prevent compiler warnings when trace macros are not used. */
|
/* Prevent compiler warnings when trace macros are not used. */
|
||||||
( void ) xTimeoutOccurred;
|
( void ) xTimeoutOccurred;
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupSync( uxReturn );
|
||||||
|
|
||||||
return uxReturn;
|
return uxReturn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -330,6 +320,8 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||||
BaseType_t xWaitConditionMet, xAlreadyYielded;
|
BaseType_t xWaitConditionMet, xAlreadyYielded;
|
||||||
BaseType_t xTimeoutOccurred = pdFALSE;
|
BaseType_t xTimeoutOccurred = pdFALSE;
|
||||||
|
|
||||||
|
traceENTER_xEventGroupWaitBits( xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait );
|
||||||
|
|
||||||
/* Check the user is not attempting to wait on the bits used by the kernel
|
/* Check the user is not attempting to wait on the bits used by the kernel
|
||||||
* itself, and that at least one bit is being requested. */
|
* itself, and that at least one bit is being requested. */
|
||||||
configASSERT( xEventGroup );
|
configASSERT( xEventGroup );
|
||||||
|
@ -415,7 +407,7 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||||
{
|
{
|
||||||
if( xAlreadyYielded == pdFALSE )
|
if( xAlreadyYielded == pdFALSE )
|
||||||
{
|
{
|
||||||
portYIELD_WITHIN_API();
|
taskYIELD_WITHIN_API();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -471,6 +463,8 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||||
/* Prevent compiler warnings when trace macros are not used. */
|
/* Prevent compiler warnings when trace macros are not used. */
|
||||||
( void ) xTimeoutOccurred;
|
( void ) xTimeoutOccurred;
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupWaitBits( uxReturn );
|
||||||
|
|
||||||
return uxReturn;
|
return uxReturn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -481,6 +475,8 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
||||||
EventGroup_t * pxEventBits = xEventGroup;
|
EventGroup_t * pxEventBits = xEventGroup;
|
||||||
EventBits_t uxReturn;
|
EventBits_t uxReturn;
|
||||||
|
|
||||||
|
traceENTER_xEventGroupClearBits( xEventGroup, uxBitsToClear );
|
||||||
|
|
||||||
/* Check the user is not attempting to clear the bits used by the kernel
|
/* Check the user is not attempting to clear the bits used by the kernel
|
||||||
* itself. */
|
* itself. */
|
||||||
configASSERT( xEventGroup );
|
configASSERT( xEventGroup );
|
||||||
|
@ -499,6 +495,8 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
||||||
}
|
}
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupClearBits( uxReturn );
|
||||||
|
|
||||||
return uxReturn;
|
return uxReturn;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -510,8 +508,12 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
||||||
{
|
{
|
||||||
BaseType_t xReturn;
|
BaseType_t xReturn;
|
||||||
|
|
||||||
|
traceENTER_xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear );
|
||||||
|
|
||||||
traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear );
|
traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear );
|
||||||
xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */
|
xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL );
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupClearBitsFromISR( xReturn );
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
@ -525,14 +527,21 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup )
|
||||||
EventGroup_t const * const pxEventBits = xEventGroup;
|
EventGroup_t const * const pxEventBits = xEventGroup;
|
||||||
EventBits_t uxReturn;
|
EventBits_t uxReturn;
|
||||||
|
|
||||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
traceENTER_xEventGroupGetBitsFromISR( xEventGroup );
|
||||||
|
|
||||||
|
/* MISRA Ref 4.7.1 [Return value shall be checked] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#dir-47 */
|
||||||
|
/* coverity[misra_c_2012_directive_4_7_violation] */
|
||||||
|
uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR();
|
||||||
{
|
{
|
||||||
uxReturn = pxEventBits->uxEventBits;
|
uxReturn = pxEventBits->uxEventBits;
|
||||||
}
|
}
|
||||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupGetBitsFromISR( uxReturn );
|
||||||
|
|
||||||
return uxReturn;
|
return uxReturn;
|
||||||
} /*lint !e818 EventGroupHandle_t is a typedef used in other functions to so can't be pointer to const. */
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
|
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
|
||||||
|
@ -542,17 +551,19 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
|
||||||
ListItem_t * pxNext;
|
ListItem_t * pxNext;
|
||||||
ListItem_t const * pxListEnd;
|
ListItem_t const * pxListEnd;
|
||||||
List_t const * pxList;
|
List_t const * pxList;
|
||||||
EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits;
|
EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits, uxReturnBits;
|
||||||
EventGroup_t * pxEventBits = xEventGroup;
|
EventGroup_t * pxEventBits = xEventGroup;
|
||||||
BaseType_t xMatchFound = pdFALSE;
|
BaseType_t xMatchFound = pdFALSE;
|
||||||
|
|
||||||
|
traceENTER_xEventGroupSetBits( xEventGroup, uxBitsToSet );
|
||||||
|
|
||||||
/* Check the user is not attempting to set the bits used by the kernel
|
/* Check the user is not attempting to set the bits used by the kernel
|
||||||
* itself. */
|
* itself. */
|
||||||
configASSERT( xEventGroup );
|
configASSERT( xEventGroup );
|
||||||
configASSERT( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
configASSERT( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
||||||
|
|
||||||
pxList = &( pxEventBits->xTasksWaitingForBits );
|
pxList = &( pxEventBits->xTasksWaitingForBits );
|
||||||
pxListEnd = listGET_END_MARKER( pxList ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxListEnd = listGET_END_MARKER( pxList );
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet );
|
traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet );
|
||||||
|
@ -624,10 +635,15 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
|
||||||
/* Clear any bits that matched when the eventCLEAR_EVENTS_ON_EXIT_BIT
|
/* Clear any bits that matched when the eventCLEAR_EVENTS_ON_EXIT_BIT
|
||||||
* bit was set in the control word. */
|
* bit was set in the control word. */
|
||||||
pxEventBits->uxEventBits &= ~uxBitsToClear;
|
pxEventBits->uxEventBits &= ~uxBitsToClear;
|
||||||
|
|
||||||
|
/* Snapshot resulting bits. */
|
||||||
|
uxReturnBits = pxEventBits->uxEventBits;
|
||||||
}
|
}
|
||||||
( void ) xTaskResumeAll();
|
( void ) xTaskResumeAll();
|
||||||
|
|
||||||
return pxEventBits->uxEventBits;
|
traceRETURN_xEventGroupSetBits( uxReturnBits );
|
||||||
|
|
||||||
|
return uxReturnBits;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -636,6 +652,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
|
||||||
EventGroup_t * pxEventBits = xEventGroup;
|
EventGroup_t * pxEventBits = xEventGroup;
|
||||||
const List_t * pxTasksWaitingForBits;
|
const List_t * pxTasksWaitingForBits;
|
||||||
|
|
||||||
|
traceENTER_vEventGroupDelete( xEventGroup );
|
||||||
|
|
||||||
configASSERT( pxEventBits );
|
configASSERT( pxEventBits );
|
||||||
|
|
||||||
pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
|
pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
|
||||||
|
@ -674,6 +692,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||||
|
|
||||||
|
traceRETURN_vEventGroupDelete();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -684,6 +704,8 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
|
||||||
BaseType_t xReturn;
|
BaseType_t xReturn;
|
||||||
EventGroup_t * pxEventBits = xEventGroup;
|
EventGroup_t * pxEventBits = xEventGroup;
|
||||||
|
|
||||||
|
traceENTER_xEventGroupGetStaticBuffer( xEventGroup, ppxEventGroupBuffer );
|
||||||
|
|
||||||
configASSERT( pxEventBits );
|
configASSERT( pxEventBits );
|
||||||
configASSERT( ppxEventGroupBuffer );
|
configASSERT( ppxEventGroupBuffer );
|
||||||
|
|
||||||
|
@ -692,6 +714,9 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
|
||||||
/* Check if the event group was statically allocated. */
|
/* Check if the event group was statically allocated. */
|
||||||
if( pxEventBits->ucStaticallyAllocated == ( uint8_t ) pdTRUE )
|
if( pxEventBits->ucStaticallyAllocated == ( uint8_t ) pdTRUE )
|
||||||
{
|
{
|
||||||
|
/* MISRA Ref 11.3.1 [Misaligned access] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-113 */
|
||||||
|
/* coverity[misra_c_2012_rule_11_3_violation] */
|
||||||
*ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits;
|
*ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits;
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
}
|
}
|
||||||
|
@ -703,11 +728,16 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
|
||||||
#else /* configSUPPORT_DYNAMIC_ALLOCATION */
|
#else /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||||
{
|
{
|
||||||
/* Event group must have been statically allocated. */
|
/* Event group must have been statically allocated. */
|
||||||
|
/* MISRA Ref 11.3.1 [Misaligned access] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-113 */
|
||||||
|
/* coverity[misra_c_2012_rule_11_3_violation] */
|
||||||
*ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits;
|
*ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits;
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
}
|
}
|
||||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupGetStaticBuffer( xReturn );
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||||
|
@ -716,18 +746,32 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
|
||||||
/* For internal use only - execute a 'set bits' command that was pended from
|
/* For internal use only - execute a 'set bits' command that was pended from
|
||||||
* an interrupt. */
|
* an interrupt. */
|
||||||
void vEventGroupSetBitsCallback( void * pvEventGroup,
|
void vEventGroupSetBitsCallback( void * pvEventGroup,
|
||||||
const uint32_t ulBitsToSet )
|
uint32_t ulBitsToSet )
|
||||||
{
|
{
|
||||||
( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */
|
traceENTER_vEventGroupSetBitsCallback( pvEventGroup, ulBitsToSet );
|
||||||
|
|
||||||
|
/* MISRA Ref 11.5.4 [Callback function parameter] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
||||||
|
/* coverity[misra_c_2012_rule_11_5_violation] */
|
||||||
|
( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet );
|
||||||
|
|
||||||
|
traceRETURN_vEventGroupSetBitsCallback();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* For internal use only - execute a 'clear bits' command that was pended from
|
/* For internal use only - execute a 'clear bits' command that was pended from
|
||||||
* an interrupt. */
|
* an interrupt. */
|
||||||
void vEventGroupClearBitsCallback( void * pvEventGroup,
|
void vEventGroupClearBitsCallback( void * pvEventGroup,
|
||||||
const uint32_t ulBitsToClear )
|
uint32_t ulBitsToClear )
|
||||||
{
|
{
|
||||||
( void ) xEventGroupClearBits( pvEventGroup, ( EventBits_t ) ulBitsToClear ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */
|
traceENTER_vEventGroupClearBitsCallback( pvEventGroup, ulBitsToClear );
|
||||||
|
|
||||||
|
/* MISRA Ref 11.5.4 [Callback function parameter] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
||||||
|
/* coverity[misra_c_2012_rule_11_5_violation] */
|
||||||
|
( void ) xEventGroupClearBits( pvEventGroup, ( EventBits_t ) ulBitsToClear );
|
||||||
|
|
||||||
|
traceRETURN_vEventGroupClearBitsCallback();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -776,8 +820,12 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
{
|
{
|
||||||
BaseType_t xReturn;
|
BaseType_t xReturn;
|
||||||
|
|
||||||
|
traceENTER_xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken );
|
||||||
|
|
||||||
traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet );
|
traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet );
|
||||||
xReturn = xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */
|
xReturn = xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken );
|
||||||
|
|
||||||
|
traceRETURN_xEventGroupSetBitsFromISR( xReturn );
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
@ -790,7 +838,13 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
UBaseType_t uxEventGroupGetNumber( void * xEventGroup )
|
UBaseType_t uxEventGroupGetNumber( void * xEventGroup )
|
||||||
{
|
{
|
||||||
UBaseType_t xReturn;
|
UBaseType_t xReturn;
|
||||||
EventGroup_t const * pxEventBits = ( EventGroup_t * ) xEventGroup; /*lint !e9087 !e9079 EventGroupHandle_t is a pointer to an EventGroup_t, but EventGroupHandle_t is kept opaque outside of this file for data hiding purposes. */
|
|
||||||
|
/* MISRA Ref 11.5.2 [Opaque pointer] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
||||||
|
/* coverity[misra_c_2012_rule_11_5_violation] */
|
||||||
|
EventGroup_t const * pxEventBits = ( EventGroup_t * ) xEventGroup;
|
||||||
|
|
||||||
|
traceENTER_uxEventGroupGetNumber( xEventGroup );
|
||||||
|
|
||||||
if( xEventGroup == NULL )
|
if( xEventGroup == NULL )
|
||||||
{
|
{
|
||||||
|
@ -801,6 +855,8 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
xReturn = pxEventBits->uxEventGroupNumber;
|
xReturn = pxEventBits->uxEventGroupNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
traceRETURN_uxEventGroupGetNumber( xReturn );
|
||||||
|
|
||||||
return xReturn;
|
return xReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,8 +868,20 @@ static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits,
|
||||||
void vEventGroupSetNumber( void * xEventGroup,
|
void vEventGroupSetNumber( void * xEventGroup,
|
||||||
UBaseType_t uxEventGroupNumber )
|
UBaseType_t uxEventGroupNumber )
|
||||||
{
|
{
|
||||||
( ( EventGroup_t * ) xEventGroup )->uxEventGroupNumber = uxEventGroupNumber; /*lint !e9087 !e9079 EventGroupHandle_t is a pointer to an EventGroup_t, but EventGroupHandle_t is kept opaque outside of this file for data hiding purposes. */
|
traceENTER_vEventGroupSetNumber( xEventGroup, uxEventGroupNumber );
|
||||||
|
|
||||||
|
/* MISRA Ref 11.5.2 [Opaque pointer] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
|
||||||
|
/* coverity[misra_c_2012_rule_11_5_violation] */
|
||||||
|
( ( EventGroup_t * ) xEventGroup )->uxEventGroupNumber = uxEventGroupNumber;
|
||||||
|
|
||||||
|
traceRETURN_vEventGroupSetNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* configUSE_TRACE_FACILITY */
|
#endif /* configUSE_TRACE_FACILITY */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This entire source file will be skipped if the application is not configured
|
||||||
|
* to include event groups functionality. If you want to include event groups
|
||||||
|
* then ensure configUSE_EVENT_GROUPS is set to 1 in FreeRTOSConfig.h. */
|
||||||
|
#endif /* configUSE_EVENT_GROUPS == 1 */
|
||||||
|
|
17
examples/README.md
Normal file
17
examples/README.md
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# README for FreeRTOS-Kernel/examples
|
||||||
|
|
||||||
|
The easiest way to use FreeRTOS is to start with one of the pre-configured demo application projects.
|
||||||
|
See [FreeRTOS/FreeRTOS/Demo](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS/Demo) to find a list of pre-configured demos on multiple platforms which demonstrate the working of the FreeRTOS-Kernel.
|
||||||
|
This directory aims to further facilitate the beginners in building their first FreeRTOS project.
|
||||||
|
|
||||||
|
|
||||||
|
## Directory Structure:
|
||||||
|
|
||||||
|
* The [cmake_example](./cmake_example) directory contains a minimal FreeRTOS example project, which uses the configuration file in the template_configuration directory listed below. This will provide you with a starting point for building your applications using FreeRTOS-Kernel.
|
||||||
|
* The [coverity](./coverity) directory contains a project to run [Synopsys Coverity](https://www.synopsys.com/software-integrity/static-analysis-tools-sast/coverity.html) for checking MISRA compliance. This directory contains further readme files and links to documentation.
|
||||||
|
* The [template_configuration](./template_configuration) directory contains a sample configuration file FreeRTOSConfig.h which helps you in preparing your application configuration
|
||||||
|
|
||||||
|
|
||||||
|
## Additional examples
|
||||||
|
|
||||||
|
Additional examples of the kernel being used in real life applications in tandem with many other libraries (i.e. FreeRTOS+TCP, coreMQTT, coreHTTP etc.) can be found [here](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS-Plus/Demo).
|
74
examples/cmake_example/CMakeLists.txt
Normal file
74
examples/cmake_example/CMakeLists.txt
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
project(example)
|
||||||
|
|
||||||
|
set(FREERTOS_KERNEL_PATH "../../")
|
||||||
|
|
||||||
|
# Add the freertos_config for FreeRTOS-Kernel
|
||||||
|
add_library(freertos_config INTERFACE)
|
||||||
|
|
||||||
|
target_include_directories(freertos_config
|
||||||
|
INTERFACE
|
||||||
|
"../template_configuration"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (DEFINED FREERTOS_SMP_EXAMPLE AND FREERTOS_SMP_EXAMPLE STREQUAL "1")
|
||||||
|
message(STATUS "Build FreeRTOS SMP example")
|
||||||
|
# Adding the following configurations to build SMP template port
|
||||||
|
add_compile_options( -DconfigNUMBER_OF_CORES=2 -DconfigUSE_PASSIVE_IDLE_HOOK=0 )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Select the heap port. values between 1-4 will pick a heap.
|
||||||
|
set(FREERTOS_HEAP "4" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
|
# Select the native compile PORT
|
||||||
|
set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
|
# Adding the FreeRTOS-Kernel subdirectory
|
||||||
|
add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel)
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Overall Compile Options
|
||||||
|
# Note the compile option strategy is to error on everything and then
|
||||||
|
# Per library opt-out of things that are warnings/errors.
|
||||||
|
# This ensures that no matter what strategy for compilation you take, the
|
||||||
|
# builds will still occur.
|
||||||
|
#
|
||||||
|
# Only tested with GNU and Clang.
|
||||||
|
# Other options are https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID
|
||||||
|
# Naming of compilers translation map:
|
||||||
|
#
|
||||||
|
# FreeRTOS | CMake
|
||||||
|
# -------------------
|
||||||
|
# CCS | ?TBD?
|
||||||
|
# GCC | GNU, Clang, *Clang Others?
|
||||||
|
# IAR | IAR
|
||||||
|
# Keil | ARMCC
|
||||||
|
# MSVC | MSVC # Note only for MinGW?
|
||||||
|
# Renesas | ?TBD?
|
||||||
|
|
||||||
|
target_compile_options(freertos_kernel PRIVATE
|
||||||
|
### Gnu/Clang C Options
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics>
|
||||||
|
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wpedantic>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wconversion>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>
|
||||||
|
|
||||||
|
# Suppressions required to build clean with clang.
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-unused-macros>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-padded>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-missing-variable-declarations>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-covered-switch-default>
|
||||||
|
$<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-cast-align> )
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME}
|
||||||
|
main.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config)
|
||||||
|
|
||||||
|
set_property(TARGET freertos_kernel PROPERTY C_STANDARD 90)
|
104
examples/cmake_example/main.c
Normal file
104
examples/cmake_example/main.c
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
/*
|
||||||
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://www.FreeRTOS.org
|
||||||
|
* https://github.com/FreeRTOS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a simple main that will start the FreeRTOS-Kernel and run a periodic task
|
||||||
|
* that only delays if compiled with the template port, this project will do nothing.
|
||||||
|
* For more information on getting started please look here:
|
||||||
|
* https://www.freertos.org/Documentation/01-FreeRTOS-quick-start/01-Beginners-guide/02-Quick-start-guide
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* FreeRTOS includes. */
|
||||||
|
#include <FreeRTOS.h>
|
||||||
|
#include <task.h>
|
||||||
|
#include <queue.h>
|
||||||
|
#include <timers.h>
|
||||||
|
#include <semphr.h>
|
||||||
|
|
||||||
|
/* Standard includes. */
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void exampleTask( void * parameters ) __attribute__( ( noreturn ) );
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void exampleTask( void * parameters )
|
||||||
|
{
|
||||||
|
/* Unused parameters. */
|
||||||
|
( void ) parameters;
|
||||||
|
|
||||||
|
for( ; ; )
|
||||||
|
{
|
||||||
|
/* Example Task Code */
|
||||||
|
vTaskDelay( 100 ); /* delay 100 ticks */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
static StaticTask_t exampleTaskTCB;
|
||||||
|
static StackType_t exampleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||||
|
|
||||||
|
( void ) printf( "Example FreeRTOS Project\n" );
|
||||||
|
|
||||||
|
( void ) xTaskCreateStatic( exampleTask,
|
||||||
|
"example",
|
||||||
|
configMINIMAL_STACK_SIZE,
|
||||||
|
NULL,
|
||||||
|
configMAX_PRIORITIES - 1U,
|
||||||
|
&( exampleTaskStack[ 0 ] ),
|
||||||
|
&( exampleTaskTCB ) );
|
||||||
|
|
||||||
|
/* Start the scheduler. */
|
||||||
|
vTaskStartScheduler();
|
||||||
|
|
||||||
|
for( ; ; )
|
||||||
|
{
|
||||||
|
/* Should not reach here. */
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if ( configCHECK_FOR_STACK_OVERFLOW > 0 )
|
||||||
|
|
||||||
|
void vApplicationStackOverflowHook( TaskHandle_t xTask,
|
||||||
|
char * pcTaskName )
|
||||||
|
{
|
||||||
|
/* Check pcTaskName for the name of the offending task,
|
||||||
|
* or pxCurrentTCB if pcTaskName has itself been corrupted. */
|
||||||
|
( void ) xTask;
|
||||||
|
( void ) pcTaskName;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* #if ( configCHECK_FOR_STACK_OVERFLOW > 0 ) */
|
||||||
|
/*-----------------------------------------------------------*/
|
46
examples/coverity/CMakeLists.txt
Normal file
46
examples/coverity/CMakeLists.txt
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
|
project(coverity)
|
||||||
|
|
||||||
|
set(FREERTOS_KERNEL_PATH "../..")
|
||||||
|
FILE(GLOB FREERTOS_KERNEL_SOURCE ${FREERTOS_KERNEL_PATH}/*.c)
|
||||||
|
FILE(GLOB FREERTOS_PORT_CODE ${FREERTOS_KERNEL_PATH}/portable/template/*.c)
|
||||||
|
|
||||||
|
# Coverity incorrectly infers the type of pdTRUE and pdFALSE as boolean because
|
||||||
|
# of their names. This generates multiple false positive warnings about type
|
||||||
|
# mismatch. Replace pdTRUE with pdPASS and pdFALSE with pdFAIL to avoid these
|
||||||
|
# false positive warnings. This workaround will not be needed after Coverity
|
||||||
|
# fixes the issue of incorrectly inferring the type of pdTRUE and pdFALSE as
|
||||||
|
# boolean.
|
||||||
|
add_custom_target(fix_source ALL
|
||||||
|
COMMAND sed -i -b -e 's/pdFALSE/pdFAIL/g' -e 's/pdTRUE/pdPASS/g' ${FREERTOS_KERNEL_SOURCE} ${FREERTOS_PORT_CODE}
|
||||||
|
DEPENDS ${FREERTOS_KERNEL_SOURCE} ${FREERTOS_PORT_CODE})
|
||||||
|
|
||||||
|
# Add the freertos_config for FreeRTOS-Kernel.
|
||||||
|
add_library(freertos_config INTERFACE)
|
||||||
|
|
||||||
|
target_include_directories(freertos_config
|
||||||
|
INTERFACE
|
||||||
|
./)
|
||||||
|
|
||||||
|
if (DEFINED FREERTOS_SMP_EXAMPLE AND FREERTOS_SMP_EXAMPLE STREQUAL "1")
|
||||||
|
message(STATUS "Build FreeRTOS SMP example")
|
||||||
|
# Adding the following configurations to build SMP template port
|
||||||
|
add_compile_options( -DconfigNUMBER_OF_CORES=2 -DconfigUSE_PASSIVE_IDLE_HOOK=0 )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Select the heap. Values between 1-5 will pick a heap.
|
||||||
|
set(FREERTOS_HEAP "3" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
|
# Select the FreeRTOS port.
|
||||||
|
set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
|
# Add the FreeRTOS-Kernel subdirectory.
|
||||||
|
add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel)
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME}
|
||||||
|
../cmake_example/main.c)
|
||||||
|
|
||||||
|
add_dependencies(${PROJECT_NAME} fix_source)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config)
|
133
examples/coverity/FreeRTOSConfig.h
Normal file
133
examples/coverity/FreeRTOSConfig.h
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
/*
|
||||||
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://www.FreeRTOS.org
|
||||||
|
* https://github.com/FreeRTOS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FREERTOS_CONFIG_H
|
||||||
|
#define FREERTOS_CONFIG_H
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Hardware description related definitions. **********************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 20000000 )
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Scheduling behaviour related definitions. **********************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define configTICK_RATE_HZ ( 100U )
|
||||||
|
#define configUSE_PREEMPTION 1
|
||||||
|
#define configUSE_TIME_SLICING 1
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||||
|
#define configUSE_TICKLESS_IDLE 1
|
||||||
|
#define configMAX_PRIORITIES 5U
|
||||||
|
#define configMINIMAL_STACK_SIZE 128U
|
||||||
|
#define configMAX_TASK_NAME_LEN 4U
|
||||||
|
#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_64_BITS
|
||||||
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
|
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 1U
|
||||||
|
#define configQUEUE_REGISTRY_SIZE 0U
|
||||||
|
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||||
|
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
|
||||||
|
#define configSTACK_DEPTH_TYPE size_t
|
||||||
|
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t
|
||||||
|
#define configUSE_NEWLIB_REENTRANT 0
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Software timer related definitions. ****************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define configUSE_TIMERS 1
|
||||||
|
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1U )
|
||||||
|
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||||
|
#define configTIMER_QUEUE_LENGTH 10U
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Memory allocation related definitions. *************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||||
|
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||||
|
#define configTOTAL_HEAP_SIZE 4096U
|
||||||
|
#define configAPPLICATION_ALLOCATED_HEAP 1
|
||||||
|
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||||
|
#define configUSE_MINI_LIST_ITEM 0
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Interrupt nesting behaviour configuration. *********************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define configKERNEL_INTERRUPT_PRIORITY 0U
|
||||||
|
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 0U
|
||||||
|
#define configMAX_API_CALL_INTERRUPT_PRIORITY 0U
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Hook and callback function related definitions. ****************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define configUSE_IDLE_HOOK 0
|
||||||
|
#define configUSE_TICK_HOOK 0
|
||||||
|
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||||
|
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
||||||
|
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Run time and task stats gathering related definitions. *********************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define configGENERATE_RUN_TIME_STATS 0
|
||||||
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||||
|
#define configKERNEL_PROVIDED_STATIC_MEMORY 1
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Definitions that include or exclude functionality. *************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define configUSE_TASK_NOTIFICATIONS 1
|
||||||
|
#define configUSE_MUTEXES 1
|
||||||
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
|
#define configUSE_QUEUE_SETS 1
|
||||||
|
#define configUSE_APPLICATION_TASK_TAG 1
|
||||||
|
#define INCLUDE_vTaskPrioritySet 1
|
||||||
|
#define INCLUDE_uxTaskPriorityGet 1
|
||||||
|
#define INCLUDE_vTaskDelete 1
|
||||||
|
#define INCLUDE_vTaskSuspend 1
|
||||||
|
#define INCLUDE_vTaskDelayUntil 1
|
||||||
|
#define INCLUDE_vTaskDelay 1
|
||||||
|
#define INCLUDE_xTaskGetSchedulerState 1
|
||||||
|
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||||
|
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||||
|
#define INCLUDE_xTaskGetIdleTaskHandle 1
|
||||||
|
#define INCLUDE_eTaskGetState 1
|
||||||
|
#define INCLUDE_xTimerPendFunctionCall 1
|
||||||
|
#define INCLUDE_xTaskAbortDelay 1
|
||||||
|
#define INCLUDE_xTaskGetHandle 1
|
||||||
|
#define INCLUDE_xTaskResumeFromISR 1
|
||||||
|
|
||||||
|
#endif /* FREERTOS_CONFIG_H */
|
64
examples/coverity/README.md
Normal file
64
examples/coverity/README.md
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
# MISRA Compliance for FreeRTOS-Kernel
|
||||||
|
FreeRTOS-Kernel is MISRA C:2012 compliant. This directory contains a project to
|
||||||
|
run [Synopsys Coverity](https://www.blackduck.com/static-analysis-tools-sast/coverity.html)
|
||||||
|
for checking MISRA compliance.
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
Coverity version 2023.6.1 incorrectly infers the type of `pdTRUE` and `pdFALSE`
|
||||||
|
as boolean because of their names, resulting in multiple false positive warnings
|
||||||
|
about type mismatch. We replace `pdTRUE` with `pdPASS` and `pdFALSE` with
|
||||||
|
`pdFAIL` to avoid these false positive warnings. This workaround will not be
|
||||||
|
needed after Coverity fixes the issue of incorrectly inferring the type of
|
||||||
|
`pdTRUE` and `pdFALSE` as boolean.
|
||||||
|
|
||||||
|
Deviations from the MISRA C:2012 guidelines are documented in
|
||||||
|
[MISRA.md](../../MISRA.md) and [coverity_misra.config](coverity_misra.config)
|
||||||
|
files.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
### Prerequisites
|
||||||
|
Coverity can be run on any platform mentioned [here](https://documentation.blackduck.com/bundle/coverity-docs/page/deploy-install-guide/topics/supported_platforms_for_coverity_analysis.html).
|
||||||
|
The following are the prerequisites to generate coverity report:
|
||||||
|
|
||||||
|
1. CMake version > 3.13.0 (You can check whether you have this by typing `cmake --version`).
|
||||||
|
2. GCC compiler.
|
||||||
|
- See download and installation instructions [here](https://gcc.gnu.org/install/).
|
||||||
|
3. Clone the repo using the following command:
|
||||||
|
- `git clone https://github.com/FreeRTOS/FreeRTOS-Kernel.git ./FreeRTOS-Kernel`
|
||||||
|
|
||||||
|
### Generating Report
|
||||||
|
Go to the root directory of the FreeRTOS-Kernel repo and run the following
|
||||||
|
commands in a terminal:
|
||||||
|
1. Update the compiler configuration in Coverity:
|
||||||
|
~~~
|
||||||
|
cov-configure --force --compiler cc --comptype gcc
|
||||||
|
~~~
|
||||||
|
2. Create the build files using CMake in a `build` directory:
|
||||||
|
|
||||||
|
Single core FreeRTOS:
|
||||||
|
~~~
|
||||||
|
cmake -B build -S examples/coverity
|
||||||
|
~~~
|
||||||
|
|
||||||
|
SMP FreeRTOS:
|
||||||
|
~~~
|
||||||
|
cmake -B build -S examples/coverity -DFREERTOS_SMP_EXAMPLE=1
|
||||||
|
~~~
|
||||||
|
3. Build the (pseudo) application:
|
||||||
|
~~~
|
||||||
|
cd build/
|
||||||
|
cov-build --emit-complementary-info --dir cov-out make coverity
|
||||||
|
~~~
|
||||||
|
4. Go to the Coverity output directory (`cov-out`) and begin Coverity static
|
||||||
|
analysis:
|
||||||
|
~~~
|
||||||
|
cov-analyze --dir ./cov-out \
|
||||||
|
--coding-standard-config ../examples/coverity/coverity_misra.config \
|
||||||
|
--tu-pattern "file('[A-Za-z_]+\.c') && ( ! file('main.c') ) && ( ! file('port.c') )"
|
||||||
|
~~~
|
||||||
|
5. Generate the HTML report:
|
||||||
|
~~~
|
||||||
|
cov-format-errors --dir ./cov-out --html-output html-output
|
||||||
|
~~~
|
||||||
|
|
||||||
|
HTML report should now be generated in a directory named `html-output`.
|
95
examples/coverity/coverity_misra.config
Normal file
95
examples/coverity/coverity_misra.config
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
{
|
||||||
|
"version" : "2.0",
|
||||||
|
"standard" : "c2012",
|
||||||
|
"title": "Coverity MISRA Configuration",
|
||||||
|
"deviations" : [
|
||||||
|
{
|
||||||
|
"deviation": "Rule 1.2",
|
||||||
|
"reason": "Allow use of __attribute__ for necessary functions placement in specific memory regions."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 3.1",
|
||||||
|
"reason": "We post HTTP links in code comments which contain // inside comments blocks."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 14.4",
|
||||||
|
"reason": "do while( 0 ) pattern is used in macros to prevent extra semi-colon."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Directive 4.4",
|
||||||
|
"reason": "Code snippet is used in comment to help explanation."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Directive 4.5",
|
||||||
|
"reason": "Allow names that MISRA considers ambiguous."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Directive 4.6",
|
||||||
|
"reason": "Allow port to use primitive type with typedefs."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Directive 4.8",
|
||||||
|
"reason": "HeapRegion_t and HeapStats_t are used only in heap files but declared in portable.h which is included in multiple source files. As a result, these definitions appear in multiple source files where they are not used."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Directive 4.9",
|
||||||
|
"reason": "FreeRTOS-Kernel is optimised to work on small micro-controllers. To achieve that, function-like macros are used."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 2.3",
|
||||||
|
"reason": "FreeRTOS defines types which is used in application."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 2.4",
|
||||||
|
"reason": "Allow to define unused tag."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 2.5",
|
||||||
|
"reason": "Allow to define unused macro."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 5.9",
|
||||||
|
"reason": "Allow to define identifier with the same name in structure and global variable."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 8.7",
|
||||||
|
"reason": "API functions are not used by the library outside of the files they are defined; however, they must be externally visible in order to be used by an application."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 8.9",
|
||||||
|
"reason": "Allow to object to be defined in wider scope for debug purpose."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 8.13",
|
||||||
|
"reason": "Allow to not to use const-qualified type for callback function."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 11.4",
|
||||||
|
"reason": "Allow to convert between a pointer to object and an interger type for stack alignment."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 15.4",
|
||||||
|
"reason": "Allow to use multiple break statements in a loop."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 15.5",
|
||||||
|
"reason": "Allow to use multiple points of exit."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 17.8",
|
||||||
|
"reason": "Allow to update the parameters of a function."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 18.4",
|
||||||
|
"reason": "Allow to use pointer arithmetic."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 19.2",
|
||||||
|
"reason": "Allow to use union."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"deviation": "Rule 20.5",
|
||||||
|
"reason": "Allow to use #undef for MPU wrappers."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
665
examples/template_configuration/FreeRTOSConfig.h
Normal file
665
examples/template_configuration/FreeRTOSConfig.h
Normal file
|
@ -0,0 +1,665 @@
|
||||||
|
/*
|
||||||
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://www.FreeRTOS.org
|
||||||
|
* https://github.com/FreeRTOS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* This file provides an example FreeRTOSConfig.h header file, inclusive of an
|
||||||
|
* abbreviated explanation of each configuration item. Online and reference
|
||||||
|
* documentation provides more information.
|
||||||
|
* https://www.freertos.org/a00110.html
|
||||||
|
*
|
||||||
|
* Constant values enclosed in square brackets ('[' and ']') must be completed
|
||||||
|
* before this file will build.
|
||||||
|
*
|
||||||
|
* Use the FreeRTOSConfig.h supplied with the RTOS port in use rather than this
|
||||||
|
* generic file, if one is available.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef FREERTOS_CONFIG_H
|
||||||
|
#define FREERTOS_CONFIG_H
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Hardware description related definitions. **********************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* In most cases, configCPU_CLOCK_HZ must be set to the frequency of the clock
|
||||||
|
* that drives the peripheral used to generate the kernels periodic tick
|
||||||
|
* interrupt. The default value is set to 20MHz and matches the QEMU demo
|
||||||
|
* settings. Your application will certainly need a different value so set this
|
||||||
|
* correctly. This is very often, but not always, equal to the main system clock
|
||||||
|
* frequency. */
|
||||||
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 20000000 )
|
||||||
|
|
||||||
|
/* configSYSTICK_CLOCK_HZ is an optional parameter for ARM Cortex-M ports only.
|
||||||
|
*
|
||||||
|
* By default ARM Cortex-M ports generate the RTOS tick interrupt from the
|
||||||
|
* Cortex-M SysTick timer. Most Cortex-M MCUs run the SysTick timer at the same
|
||||||
|
* frequency as the MCU itself - when that is the case configSYSTICK_CLOCK_HZ is
|
||||||
|
* not needed and should be left undefined. If the SysTick timer is clocked at a
|
||||||
|
* different frequency to the MCU core then set configCPU_CLOCK_HZ to the MCU
|
||||||
|
* clock frequency, as normal, and configSYSTICK_CLOCK_HZ to the SysTick clock
|
||||||
|
* frequency. Not used if left undefined.
|
||||||
|
* The default value is undefined (commented out). If you need this value bring
|
||||||
|
* it back and set it to a suitable value. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define configSYSTICK_CLOCK_HZ [Platform specific]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Scheduling behaviour related definitions. **********************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* configTICK_RATE_HZ sets frequency of the tick interrupt in Hz, normally
|
||||||
|
* calculated from the configCPU_CLOCK_HZ value. */
|
||||||
|
#define configTICK_RATE_HZ 100
|
||||||
|
|
||||||
|
/* Set configUSE_PREEMPTION to 1 to use pre-emptive scheduling. Set
|
||||||
|
* configUSE_PREEMPTION to 0 to use co-operative scheduling.
|
||||||
|
* See https://www.freertos.org/single-core-amp-smp-rtos-scheduling.html. */
|
||||||
|
#define configUSE_PREEMPTION 1
|
||||||
|
|
||||||
|
/* Set configUSE_TIME_SLICING to 1 to have the scheduler switch between Ready
|
||||||
|
* state tasks of equal priority on every tick interrupt. Set
|
||||||
|
* configUSE_TIME_SLICING to 0 to prevent the scheduler switching between Ready
|
||||||
|
* state tasks just because there was a tick interrupt. See
|
||||||
|
* https://freertos.org/single-core-amp-smp-rtos-scheduling.html. */
|
||||||
|
#define configUSE_TIME_SLICING 0
|
||||||
|
|
||||||
|
/* Set configUSE_PORT_OPTIMISED_TASK_SELECTION to 1 to select the next task to
|
||||||
|
* run using an algorithm optimised to the instruction set of the target
|
||||||
|
* hardware - normally using a count leading zeros assembly instruction. Set to
|
||||||
|
* 0 to select the next task to run using a generic C algorithm that works for
|
||||||
|
* all FreeRTOS ports. Not all FreeRTOS ports have this option. Defaults to 0
|
||||||
|
* if left undefined. */
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||||
|
|
||||||
|
/* Set configUSE_TICKLESS_IDLE to 1 to use the low power tickless mode. Set to
|
||||||
|
* 0 to keep the tick interrupt running at all times. Not all FreeRTOS ports
|
||||||
|
* support tickless mode. See
|
||||||
|
* https://www.freertos.org/low-power-tickless-rtos.html Defaults to 0 if left
|
||||||
|
* undefined. */
|
||||||
|
#define configUSE_TICKLESS_IDLE 0
|
||||||
|
|
||||||
|
/* configMAX_PRIORITIES Sets the number of available task priorities. Tasks can
|
||||||
|
* be assigned priorities of 0 to (configMAX_PRIORITIES - 1). Zero is the
|
||||||
|
* lowest priority. */
|
||||||
|
#define configMAX_PRIORITIES 5
|
||||||
|
|
||||||
|
/* configMINIMAL_STACK_SIZE defines the size of the stack used by the Idle task
|
||||||
|
* (in words, not in bytes!). The kernel does not use this constant for any
|
||||||
|
* other purpose. Demo applications use the constant to make the demos somewhat
|
||||||
|
* portable across hardware architectures. */
|
||||||
|
#define configMINIMAL_STACK_SIZE 128
|
||||||
|
|
||||||
|
/* configMAX_TASK_NAME_LEN sets the maximum length (in characters) of a task's
|
||||||
|
* human readable name. Includes the NULL terminator. */
|
||||||
|
#define configMAX_TASK_NAME_LEN 16
|
||||||
|
|
||||||
|
/* Time is measured in 'ticks' - which is the number of times the tick interrupt
|
||||||
|
* has executed since the RTOS kernel was started.
|
||||||
|
* The tick count is held in a variable of type TickType_t.
|
||||||
|
*
|
||||||
|
* configTICK_TYPE_WIDTH_IN_BITS controls the type (and therefore bit-width) of
|
||||||
|
* TickType_t:
|
||||||
|
*
|
||||||
|
* Defining configTICK_TYPE_WIDTH_IN_BITS as TICK_TYPE_WIDTH_16_BITS causes
|
||||||
|
* TickType_t to be defined (typedef'ed) as an unsigned 16-bit type.
|
||||||
|
*
|
||||||
|
* Defining configTICK_TYPE_WIDTH_IN_BITS as TICK_TYPE_WIDTH_32_BITS causes
|
||||||
|
* TickType_t to be defined (typedef'ed) as an unsigned 32-bit type.
|
||||||
|
*
|
||||||
|
* Defining configTICK_TYPE_WIDTH_IN_BITS as TICK_TYPE_WIDTH_64_BITS causes
|
||||||
|
* TickType_t to be defined (typedef'ed) as an unsigned 64-bit type. */
|
||||||
|
#define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_64_BITS
|
||||||
|
|
||||||
|
/* Set configIDLE_SHOULD_YIELD to 1 to have the Idle task yield to an
|
||||||
|
* application task if there is an Idle priority (priority 0) application task
|
||||||
|
* that can run. Set to 0 to have the Idle task use all of its timeslice.
|
||||||
|
* Default to 1 if left undefined. */
|
||||||
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
|
|
||||||
|
/* Each task has an array of task notifications.
|
||||||
|
* configTASK_NOTIFICATION_ARRAY_ENTRIES sets the number of indexes in the
|
||||||
|
* array. See https://www.freertos.org/RTOS-task-notifications.html Defaults to
|
||||||
|
* 1 if left undefined. */
|
||||||
|
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
|
||||||
|
|
||||||
|
/* configQUEUE_REGISTRY_SIZE sets the maximum number of queues and semaphores
|
||||||
|
* that can be referenced from the queue registry. Only required when using a
|
||||||
|
* kernel aware debugger. Defaults to 0 if left undefined. */
|
||||||
|
#define configQUEUE_REGISTRY_SIZE 0
|
||||||
|
|
||||||
|
/* Set configENABLE_BACKWARD_COMPATIBILITY to 1 to map function names and
|
||||||
|
* datatypes from old version of FreeRTOS to their latest equivalent. Defaults
|
||||||
|
* to 1 if left undefined. */
|
||||||
|
#define configENABLE_BACKWARD_COMPATIBILITY 0
|
||||||
|
|
||||||
|
/* Each task has its own array of pointers that can be used as thread local
|
||||||
|
* storage. configNUM_THREAD_LOCAL_STORAGE_POINTERS set the number of indexes
|
||||||
|
* in the array. See
|
||||||
|
* https://www.freertos.org/thread-local-storage-pointers.html Defaults to 0 if
|
||||||
|
* left undefined. */
|
||||||
|
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
|
||||||
|
|
||||||
|
/* When configUSE_MINI_LIST_ITEM is set to 0, MiniListItem_t and ListItem_t are
|
||||||
|
* both the same. When configUSE_MINI_LIST_ITEM is set to 1, MiniListItem_t
|
||||||
|
* contains 3 fewer fields than ListItem_t which saves some RAM at the cost of
|
||||||
|
* violating strict aliasing rules which some compilers depend on for
|
||||||
|
* optimization. Defaults to 1 if left undefined. */
|
||||||
|
#define configUSE_MINI_LIST_ITEM 1
|
||||||
|
|
||||||
|
/* Sets the type used by the parameter to xTaskCreate() that specifies the stack
|
||||||
|
* size of the task being created. The same type is used to return information
|
||||||
|
* about stack usage in various other API calls. Defaults to size_t if left
|
||||||
|
* undefined. */
|
||||||
|
#define configSTACK_DEPTH_TYPE size_t
|
||||||
|
|
||||||
|
/* configMESSAGE_BUFFER_LENGTH_TYPE sets the type used to store the length of
|
||||||
|
* each message written to a FreeRTOS message buffer (the length is also written
|
||||||
|
* to the message buffer. Defaults to size_t if left undefined - but that may
|
||||||
|
* waste space if messages never go above a length that could be held in a
|
||||||
|
* uint8_t. */
|
||||||
|
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t
|
||||||
|
|
||||||
|
/* If configHEAP_CLEAR_MEMORY_ON_FREE is set to 1, then blocks of memory
|
||||||
|
* allocated using pvPortMalloc() will be cleared (i.e. set to zero) when freed
|
||||||
|
* using vPortFree(). Defaults to 0 if left undefined. */
|
||||||
|
#define configHEAP_CLEAR_MEMORY_ON_FREE 1
|
||||||
|
|
||||||
|
/* vTaskList and vTaskGetRunTimeStats APIs take a buffer as a parameter and
|
||||||
|
* assume that the length of the buffer is configSTATS_BUFFER_MAX_LENGTH.
|
||||||
|
* Defaults to 0xFFFF if left undefined. New applications are recommended to use
|
||||||
|
* vTaskListTasks and vTaskGetRunTimeStatistics APIs instead and supply the
|
||||||
|
* length of the buffer explicitly to avoid memory corruption. */
|
||||||
|
#define configSTATS_BUFFER_MAX_LENGTH 0xFFFF
|
||||||
|
|
||||||
|
/* Set configUSE_NEWLIB_REENTRANT to 1 to have a newlib reent structure
|
||||||
|
* allocated for each task. Set to 0 to not support newlib reent structures.
|
||||||
|
* Default to 0 if left undefined.
|
||||||
|
*
|
||||||
|
* Note Newlib support has been included by popular demand, but is not used or
|
||||||
|
* tested by the FreeRTOS maintainers themselves. FreeRTOS is not responsible
|
||||||
|
* for resulting newlib operation. User must be familiar with newlib and must
|
||||||
|
* provide system-wide implementations of the necessary stubs. Note that (at the
|
||||||
|
* time of writing) the current newlib design implements a system-wide malloc()
|
||||||
|
* that must be provided with locks. */
|
||||||
|
#define configUSE_NEWLIB_REENTRANT 0
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Software timer related definitions. ****************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configUSE_TIMERS to 1 to include software timer functionality in the
|
||||||
|
* build. Set to 0 to exclude software timer functionality from the build. The
|
||||||
|
* FreeRTOS/source/timers.c source file must be included in the build if
|
||||||
|
* configUSE_TIMERS is set to 1. Default to 0 if left undefined. See
|
||||||
|
* https://www.freertos.org/RTOS-software-timer.html. */
|
||||||
|
#define configUSE_TIMERS 1
|
||||||
|
|
||||||
|
/* configTIMER_TASK_PRIORITY sets the priority used by the timer task. Only
|
||||||
|
* used if configUSE_TIMERS is set to 1. The timer task is a standard FreeRTOS
|
||||||
|
* task, so its priority is set like any other task. See
|
||||||
|
* https://www.freertos.org/RTOS-software-timer-service-daemon-task.html Only
|
||||||
|
* used if configUSE_TIMERS is set to 1. */
|
||||||
|
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||||
|
|
||||||
|
/* configTIMER_TASK_STACK_DEPTH sets the size of the stack allocated to the
|
||||||
|
* timer task (in words, not in bytes!). The timer task is a standard FreeRTOS
|
||||||
|
* task. See
|
||||||
|
* https://www.freertos.org/RTOS-software-timer-service-daemon-task.html Only
|
||||||
|
* used if configUSE_TIMERS is set to 1. */
|
||||||
|
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||||
|
|
||||||
|
/* configTIMER_QUEUE_LENGTH sets the length of the queue (the number of discrete
|
||||||
|
* items the queue can hold) used to send commands to the timer task. See
|
||||||
|
* https://www.freertos.org/RTOS-software-timer-service-daemon-task.html Only
|
||||||
|
* used if configUSE_TIMERS is set to 1. */
|
||||||
|
#define configTIMER_QUEUE_LENGTH 10
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Event Group related definitions. *******************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configUSE_EVENT_GROUPS to 1 to include event group functionality in the
|
||||||
|
* build. Set to 0 to exclude event group functionality from the build. The
|
||||||
|
* FreeRTOS/source/event_groups.c source file must be included in the build if
|
||||||
|
* configUSE_EVENT_GROUPS is set to 1. Defaults to 1 if left undefined. */
|
||||||
|
|
||||||
|
#define configUSE_EVENT_GROUPS 1
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Stream Buffer related definitions. *****************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configUSE_STREAM_BUFFERS to 1 to include stream buffer functionality in
|
||||||
|
* the build. Set to 0 to exclude event group functionality from the build. The
|
||||||
|
* FreeRTOS/source/stream_buffer.c source file must be included in the build if
|
||||||
|
* configUSE_STREAM_BUFFERS is set to 1. Defaults to 1 if left undefined. */
|
||||||
|
|
||||||
|
#define configUSE_STREAM_BUFFERS 1
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Memory allocation related definitions. *************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configSUPPORT_STATIC_ALLOCATION to 1 to include FreeRTOS API functions
|
||||||
|
* that create FreeRTOS objects (tasks, queues, etc.) using statically allocated
|
||||||
|
* memory in the build. Set to 0 to exclude the ability to create statically
|
||||||
|
* allocated objects from the build. Defaults to 0 if left undefined. See
|
||||||
|
* https://www.freertos.org/Static_Vs_Dynamic_Memory_Allocation.html. */
|
||||||
|
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||||
|
|
||||||
|
/* Set configSUPPORT_DYNAMIC_ALLOCATION to 1 to include FreeRTOS API functions
|
||||||
|
* that create FreeRTOS objects (tasks, queues, etc.) using dynamically
|
||||||
|
* allocated memory in the build. Set to 0 to exclude the ability to create
|
||||||
|
* dynamically allocated objects from the build. Defaults to 1 if left
|
||||||
|
* undefined. See
|
||||||
|
* https://www.freertos.org/Static_Vs_Dynamic_Memory_Allocation.html. */
|
||||||
|
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||||
|
|
||||||
|
/* Sets the total size of the FreeRTOS heap, in bytes, when heap_1.c, heap_2.c
|
||||||
|
* or heap_4.c are included in the build. This value is defaulted to 4096 bytes
|
||||||
|
* but it must be tailored to each application. Note the heap will appear in
|
||||||
|
* the .bss section. See https://www.freertos.org/a00111.html. */
|
||||||
|
#define configTOTAL_HEAP_SIZE 4096
|
||||||
|
|
||||||
|
/* Set configAPPLICATION_ALLOCATED_HEAP to 1 to have the application allocate
|
||||||
|
* the array used as the FreeRTOS heap. Set to 0 to have the linker allocate
|
||||||
|
* the array used as the FreeRTOS heap. Defaults to 0 if left undefined. */
|
||||||
|
#define configAPPLICATION_ALLOCATED_HEAP 0
|
||||||
|
|
||||||
|
/* Set configSTACK_ALLOCATION_FROM_SEPARATE_HEAP to 1 to have task stacks
|
||||||
|
* allocated from somewhere other than the FreeRTOS heap. This is useful if you
|
||||||
|
* want to ensure stacks are held in fast memory. Set to 0 to have task stacks
|
||||||
|
* come from the standard FreeRTOS heap. The application writer must provide
|
||||||
|
* implementations for pvPortMallocStack() and vPortFreeStack() if set to 1.
|
||||||
|
* Defaults to 0 if left undefined. */
|
||||||
|
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||||
|
|
||||||
|
/* Set configENABLE_HEAP_PROTECTOR to 1 to enable bounds checking and
|
||||||
|
* obfuscation to internal heap block pointers in heap_4.c and heap_5.c to help
|
||||||
|
* catch pointer corruptions. Defaults to 0 if left undefined. */
|
||||||
|
#define configENABLE_HEAP_PROTECTOR 0
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Interrupt nesting behaviour configuration. *********************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* configKERNEL_INTERRUPT_PRIORITY sets the priority of the tick and context
|
||||||
|
* switch performing interrupts. Not supported by all FreeRTOS ports. See
|
||||||
|
* https://www.freertos.org/RTOS-Cortex-M3-M4.html for information specific to
|
||||||
|
* ARM Cortex-M devices. */
|
||||||
|
#define configKERNEL_INTERRUPT_PRIORITY 0
|
||||||
|
|
||||||
|
/* configMAX_SYSCALL_INTERRUPT_PRIORITY sets the interrupt priority above which
|
||||||
|
* FreeRTOS API calls must not be made. Interrupts above this priority are
|
||||||
|
* never disabled, so never delayed by RTOS activity. The default value is set
|
||||||
|
* to the highest interrupt priority (0). Not supported by all FreeRTOS ports.
|
||||||
|
* See https://www.freertos.org/RTOS-Cortex-M3-M4.html for information specific
|
||||||
|
* to ARM Cortex-M devices. */
|
||||||
|
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 0
|
||||||
|
|
||||||
|
/* Another name for configMAX_SYSCALL_INTERRUPT_PRIORITY - the name used depends
|
||||||
|
* on the FreeRTOS port. */
|
||||||
|
#define configMAX_API_CALL_INTERRUPT_PRIORITY 0
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Hook and callback function related definitions. ****************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set the following configUSE_* constants to 1 to include the named hook
|
||||||
|
* functionality in the build. Set to 0 to exclude the hook functionality from
|
||||||
|
* the build. The application writer is responsible for providing the hook
|
||||||
|
* function for any set to 1. See https://www.freertos.org/a00016.html. */
|
||||||
|
#define configUSE_IDLE_HOOK 0
|
||||||
|
#define configUSE_TICK_HOOK 0
|
||||||
|
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||||
|
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
||||||
|
|
||||||
|
/* Set configUSE_SB_COMPLETED_CALLBACK to 1 to have send and receive completed
|
||||||
|
* callbacks for each instance of a stream buffer or message buffer. When the
|
||||||
|
* option is set to 1, APIs xStreamBufferCreateWithCallback() and
|
||||||
|
* xStreamBufferCreateStaticWithCallback() (and likewise APIs for message
|
||||||
|
* buffer) can be used to create a stream buffer or message buffer instance
|
||||||
|
* with application provided callbacks. Defaults to 0 if left undefined. */
|
||||||
|
#define configUSE_SB_COMPLETED_CALLBACK 0
|
||||||
|
|
||||||
|
/* Set configCHECK_FOR_STACK_OVERFLOW to 1 or 2 for FreeRTOS to check for a
|
||||||
|
* stack overflow at the time of a context switch. Set to 0 to not look for a
|
||||||
|
* stack overflow. If configCHECK_FOR_STACK_OVERFLOW is 1 then the check only
|
||||||
|
* looks for the stack pointer being out of bounds when a task's context is
|
||||||
|
* saved to its stack - this is fast but somewhat ineffective. If
|
||||||
|
* configCHECK_FOR_STACK_OVERFLOW is 2 then the check looks for a pattern
|
||||||
|
* written to the end of a task's stack having been overwritten. This is
|
||||||
|
* slower, but will catch most (but not all) stack overflows. The application
|
||||||
|
* writer must provide the stack overflow callback when
|
||||||
|
* configCHECK_FOR_STACK_OVERFLOW is set to 1. See
|
||||||
|
* https://www.freertos.org/Stacks-and-stack-overflow-checking.html Defaults to
|
||||||
|
* 0 if left undefined. */
|
||||||
|
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Run time and task stats gathering related definitions. *********************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configGENERATE_RUN_TIME_STATS to 1 to have FreeRTOS collect data on the
|
||||||
|
* processing time used by each task. Set to 0 to not collect the data. The
|
||||||
|
* application writer needs to provide a clock source if set to 1. Defaults to
|
||||||
|
* 0 if left undefined. See https://www.freertos.org/rtos-run-time-stats.html.
|
||||||
|
*/
|
||||||
|
#define configGENERATE_RUN_TIME_STATS 0
|
||||||
|
|
||||||
|
/* Set configUSE_TRACE_FACILITY to include additional task structure members
|
||||||
|
* are used by trace and visualisation functions and tools. Set to 0 to exclude
|
||||||
|
* the additional information from the structures. Defaults to 0 if left
|
||||||
|
* undefined. */
|
||||||
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
|
||||||
|
/* Set to 1 to include the vTaskList() and vTaskGetRunTimeStats() functions in
|
||||||
|
* the build. Set to 0 to exclude these functions from the build. These two
|
||||||
|
* functions introduce a dependency on string formatting functions that would
|
||||||
|
* otherwise not exist - hence they are kept separate. Defaults to 0 if left
|
||||||
|
* undefined. */
|
||||||
|
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Co-routine related definitions. ********************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configUSE_CO_ROUTINES to 1 to include co-routine functionality in the
|
||||||
|
* build, or 0 to omit co-routine functionality from the build. To include
|
||||||
|
* co-routines, croutine.c must be included in the project. Defaults to 0 if
|
||||||
|
* left undefined. */
|
||||||
|
#define configUSE_CO_ROUTINES 0
|
||||||
|
|
||||||
|
/* configMAX_CO_ROUTINE_PRIORITIES defines the number of priorities available
|
||||||
|
* to the application co-routines. Any number of co-routines can share the same
|
||||||
|
* priority. Defaults to 0 if left undefined. */
|
||||||
|
#define configMAX_CO_ROUTINE_PRIORITIES 1
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Debugging assistance. ******************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* configASSERT() has the same semantics as the standard C assert(). It can
|
||||||
|
* either be defined to take an action when the assertion fails, or not defined
|
||||||
|
* at all (i.e. comment out or delete the definitions) to completely remove
|
||||||
|
* assertions. configASSERT() can be defined to anything you want, for example
|
||||||
|
* you can call a function if an assert fails that passes the filename and line
|
||||||
|
* number of the failing assert (for example, "vAssertCalled( __FILE__, __LINE__
|
||||||
|
* )" or it can simple disable interrupts and sit in a loop to halt all
|
||||||
|
* execution on the failing line for viewing in a debugger. */
|
||||||
|
#define configASSERT( x ) \
|
||||||
|
if( ( x ) == 0 ) \
|
||||||
|
{ \
|
||||||
|
taskDISABLE_INTERRUPTS(); \
|
||||||
|
for( ; ; ) \
|
||||||
|
; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* FreeRTOS MPU specific definitions. *****************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* If configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS is set to 1 then
|
||||||
|
* the application writer can provide functions that execute in privileged mode.
|
||||||
|
* See:
|
||||||
|
* https://www.freertos.org/a00110.html#configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
|
||||||
|
* Defaults to 0 if left undefined. Only used by the FreeRTOS Cortex-M MPU
|
||||||
|
* ports, not the standard ARMv7-M Cortex-M port. */
|
||||||
|
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
|
||||||
|
|
||||||
|
/* Set configTOTAL_MPU_REGIONS to the number of MPU regions implemented on your
|
||||||
|
* target hardware. Normally 8 or 16. Only used by the FreeRTOS Cortex-M MPU
|
||||||
|
* ports, not the standard ARMv7-M Cortex-M port. Defaults to 8 if left
|
||||||
|
* undefined. */
|
||||||
|
#define configTOTAL_MPU_REGIONS 8
|
||||||
|
|
||||||
|
/* configTEX_S_C_B_FLASH allows application writers to override the default
|
||||||
|
* values for the for TEX, Shareable (S), Cacheable (C) and Bufferable (B) bits
|
||||||
|
* for the MPU region covering Flash. Defaults to 0x07UL (which means TEX=000,
|
||||||
|
* S=1, C=1, B=1) if left undefined. Only used by the FreeRTOS Cortex-M MPU
|
||||||
|
* ports, not the standard ARMv7-M Cortex-M port. */
|
||||||
|
#define configTEX_S_C_B_FLASH 0x07UL
|
||||||
|
|
||||||
|
/* configTEX_S_C_B_SRAM allows application writers to override the default
|
||||||
|
* values for the for TEX, Shareable (S), Cacheable (C) and Bufferable (B) bits
|
||||||
|
* for the MPU region covering RAM. Defaults to 0x07UL (which means TEX=000,
|
||||||
|
* S=1, C=1, B=1) if left undefined. Only used by the FreeRTOS Cortex-M MPU
|
||||||
|
* ports, not the standard ARMv7-M Cortex-M port. */
|
||||||
|
#define configTEX_S_C_B_SRAM 0x07UL
|
||||||
|
|
||||||
|
/* Set configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY to 0 to prevent any privilege
|
||||||
|
* escalations originating from outside of the kernel code itself. Set to 1 to
|
||||||
|
* allow application tasks to raise privilege. Defaults to 1 if left undefined.
|
||||||
|
* Only used by the FreeRTOS Cortex-M MPU ports, not the standard ARMv7-M
|
||||||
|
* Cortex-M port. */
|
||||||
|
#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 1
|
||||||
|
|
||||||
|
/* Set configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS to 1 to allow unprivileged
|
||||||
|
* tasks enter critical sections (effectively mask interrupts). Set to 0 to
|
||||||
|
* prevent unprivileged tasks entering critical sections. Defaults to 1 if left
|
||||||
|
* undefined. Only used by the FreeRTOS Cortex-M MPU ports, not the standard
|
||||||
|
* ARMv7-M Cortex-M port. */
|
||||||
|
#define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 0
|
||||||
|
|
||||||
|
/* FreeRTOS Kernel version 10.6.0 introduced a new v2 MPU wrapper, namely
|
||||||
|
* mpu_wrappers_v2.c. Set configUSE_MPU_WRAPPERS_V1 to 0 to use the new v2 MPU
|
||||||
|
* wrapper. Set configUSE_MPU_WRAPPERS_V1 to 1 to use the old v1 MPU wrapper
|
||||||
|
* (mpu_wrappers.c). Defaults to 0 if left undefined. */
|
||||||
|
#define configUSE_MPU_WRAPPERS_V1 0
|
||||||
|
|
||||||
|
/* When using the v2 MPU wrapper, set configPROTECTED_KERNEL_OBJECT_POOL_SIZE to
|
||||||
|
* the total number of kernel objects, which includes tasks, queues, semaphores,
|
||||||
|
* mutexes, event groups, timers, stream buffers and message buffers, in your
|
||||||
|
* application. The application will not be able to have more than
|
||||||
|
* configPROTECTED_KERNEL_OBJECT_POOL_SIZE kernel objects at any point of
|
||||||
|
* time. */
|
||||||
|
#define configPROTECTED_KERNEL_OBJECT_POOL_SIZE 10
|
||||||
|
|
||||||
|
/* When using the v2 MPU wrapper, set configSYSTEM_CALL_STACK_SIZE to the size
|
||||||
|
* of the system call stack in words. Each task has a statically allocated
|
||||||
|
* memory buffer of this size which is used as the stack to execute system
|
||||||
|
* calls. For example, if configSYSTEM_CALL_STACK_SIZE is defined as 128 and
|
||||||
|
* there are 10 tasks in the application, the total amount of memory used for
|
||||||
|
* system call stacks is 128 * 10 = 1280 words. */
|
||||||
|
#define configSYSTEM_CALL_STACK_SIZE 128
|
||||||
|
|
||||||
|
/* When using the v2 MPU wrapper, set configENABLE_ACCESS_CONTROL_LIST to 1 to
|
||||||
|
* enable Access Control List (ACL) feature. When ACL is enabled, an
|
||||||
|
* unprivileged task by default does not have access to any kernel object other
|
||||||
|
* than itself. The application writer needs to explicitly grant the
|
||||||
|
* unprivileged task access to the kernel objects it needs using the APIs
|
||||||
|
* provided for the same. Defaults to 0 if left undefined. */
|
||||||
|
#define configENABLE_ACCESS_CONTROL_LIST 1
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* SMP( Symmetric MultiProcessing ) Specific Configuration definitions. *******/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configNUMBER_OF_CORES to the number of available processor cores.
|
||||||
|
* Defaults to 1 if left undefined. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define configNUMBER_OF_CORES [Num of available cores]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* When using SMP (i.e. configNUMBER_OF_CORES is greater than one), set
|
||||||
|
* configRUN_MULTIPLE_PRIORITIES to 0 to allow multiple tasks to run
|
||||||
|
* simultaneously only if they do not have equal priority, thereby maintaining
|
||||||
|
* the paradigm of a lower priority task never running if a higher priority task
|
||||||
|
* is able to run. If configRUN_MULTIPLE_PRIORITIES is set to 1, multiple tasks
|
||||||
|
* with different priorities may run simultaneously - so a higher and lower
|
||||||
|
* priority task may run on different cores at the same time. */
|
||||||
|
#define configRUN_MULTIPLE_PRIORITIES 0
|
||||||
|
|
||||||
|
/* When using SMP (i.e. configNUMBER_OF_CORES is greater than one), set
|
||||||
|
* configUSE_CORE_AFFINITY to 1 to enable core affinity feature. When core
|
||||||
|
* affinity feature is enabled, the vTaskCoreAffinitySet and
|
||||||
|
* vTaskCoreAffinityGet APIs can be used to set and retrieve which cores a task
|
||||||
|
* can run on. If configUSE_CORE_AFFINITY is set to 0 then the FreeRTOS
|
||||||
|
* scheduler is free to run any task on any available core. */
|
||||||
|
#define configUSE_CORE_AFFINITY 0
|
||||||
|
|
||||||
|
/* When using SMP with core affinity feature enabled, set
|
||||||
|
* configTASK_DEFAULT_CORE_AFFINITY to change the default core affinity mask for
|
||||||
|
* tasks created without an affinity mask specified. Setting the define to 1
|
||||||
|
* would make such tasks run on core 0 and setting it to (1 <<
|
||||||
|
* portGET_CORE_ID()) would make such tasks run on the current core. This config
|
||||||
|
* value is useful, if swapping tasks between cores is not supported (e.g.
|
||||||
|
* Tricore) or if legacy code should be controlled. Defaults to tskNO_AFFINITY
|
||||||
|
* if left undefined. */
|
||||||
|
#define configTASK_DEFAULT_CORE_AFFINITY tskNO_AFFINITY
|
||||||
|
|
||||||
|
/* When using SMP (i.e. configNUMBER_OF_CORES is greater than one), if
|
||||||
|
* configUSE_TASK_PREEMPTION_DISABLE is set to 1, individual tasks can be set to
|
||||||
|
* either pre-emptive or co-operative mode using the vTaskPreemptionDisable and
|
||||||
|
* vTaskPreemptionEnable APIs. */
|
||||||
|
#define configUSE_TASK_PREEMPTION_DISABLE 0
|
||||||
|
|
||||||
|
/* When using SMP (i.e. configNUMBER_OF_CORES is greater than one), set
|
||||||
|
* configUSE_PASSIVE_IDLE_HOOK to 1 to allow the application writer to use
|
||||||
|
* the passive idle task hook to add background functionality without the
|
||||||
|
* overhead of a separate task. Defaults to 0 if left undefined. */
|
||||||
|
#define configUSE_PASSIVE_IDLE_HOOK 0
|
||||||
|
|
||||||
|
/* When using SMP (i.e. configNUMBER_OF_CORES is greater than one),
|
||||||
|
* configTIMER_SERVICE_TASK_CORE_AFFINITY allows the application writer to set
|
||||||
|
* the core affinity of the RTOS Daemon/Timer Service task. Defaults to
|
||||||
|
* tskNO_AFFINITY if left undefined. */
|
||||||
|
#define configTIMER_SERVICE_TASK_CORE_AFFINITY tskNO_AFFINITY
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* ARMv8-M secure side port related definitions. ******************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* secureconfigMAX_SECURE_CONTEXTS define the maximum number of tasks that can
|
||||||
|
* call into the secure side of an ARMv8-M chip. Not used by any other ports.
|
||||||
|
*/
|
||||||
|
#define secureconfigMAX_SECURE_CONTEXTS 5
|
||||||
|
|
||||||
|
/* Defines the kernel provided implementation of
|
||||||
|
* vApplicationGetIdleTaskMemory() and vApplicationGetTimerTaskMemory()
|
||||||
|
* to provide the memory that is used by the Idle task and Timer task
|
||||||
|
* respectively. The application can provide it's own implementation of
|
||||||
|
* vApplicationGetIdleTaskMemory() and vApplicationGetTimerTaskMemory() by
|
||||||
|
* setting configKERNEL_PROVIDED_STATIC_MEMORY to 0 or leaving it undefined. */
|
||||||
|
#define configKERNEL_PROVIDED_STATIC_MEMORY 1
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* ARMv8-M port Specific Configuration definitions. ***************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configENABLE_TRUSTZONE to 1 when running FreeRTOS on the non-secure side
|
||||||
|
* to enable the TrustZone support in FreeRTOS ARMv8-M ports which allows the
|
||||||
|
* non-secure FreeRTOS tasks to call the (non-secure callable) functions
|
||||||
|
* exported from secure side. */
|
||||||
|
#define configENABLE_TRUSTZONE 1
|
||||||
|
|
||||||
|
/* If the application writer does not want to use TrustZone, but the hardware
|
||||||
|
* does not support disabling TrustZone then the entire application (including
|
||||||
|
* the FreeRTOS scheduler) can run on the secure side without ever branching to
|
||||||
|
* the non-secure side. To do that, in addition to setting
|
||||||
|
* configENABLE_TRUSTZONE to 0, also set configRUN_FREERTOS_SECURE_ONLY to 1. */
|
||||||
|
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||||
|
|
||||||
|
/* Set configENABLE_MPU to 1 to enable the Memory Protection Unit (MPU), or 0
|
||||||
|
* to leave the Memory Protection Unit disabled. */
|
||||||
|
#define configENABLE_MPU 1
|
||||||
|
|
||||||
|
/* Set configENABLE_FPU to 1 to enable the Floating Point Unit (FPU), or 0
|
||||||
|
* to leave the Floating Point Unit disabled. */
|
||||||
|
#define configENABLE_FPU 1
|
||||||
|
|
||||||
|
/* Set configENABLE_MVE to 1 to enable the M-Profile Vector Extension (MVE)
|
||||||
|
* support, or 0 to leave the MVE support disabled. This option is only
|
||||||
|
* applicable to Cortex-M55 and Cortex-M85 ports as M-Profile Vector Extension
|
||||||
|
* (MVE) is available only on these architectures. configENABLE_MVE must be left
|
||||||
|
* undefined, or defined to 0 for the Cortex-M23,Cortex-M33 and Cortex-M35P
|
||||||
|
* ports. */
|
||||||
|
#define configENABLE_MVE 1
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* ARMv7-M and ARMv8-M port Specific Configuration definitions. ***************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set configCHECK_HANDLER_INSTALLATION to 1 to enable additional asserts to
|
||||||
|
* verify that the application has correctly installed FreeRTOS interrupt
|
||||||
|
* handlers.
|
||||||
|
*
|
||||||
|
* An application can install FreeRTOS interrupt handlers in one of the
|
||||||
|
* following ways:
|
||||||
|
* 1. Direct Routing - Install the functions vPortSVCHandler and
|
||||||
|
* xPortPendSVHandler for SVC call and PendSV interrupts respectively.
|
||||||
|
* 2. Indirect Routing - Install separate handlers for SVC call and PendSV
|
||||||
|
* interrupts and route program control from those
|
||||||
|
* handlers to vPortSVCHandler and xPortPendSVHandler functions. The
|
||||||
|
* applications that use Indirect Routing must set
|
||||||
|
* configCHECK_HANDLER_INSTALLATION to 0.
|
||||||
|
*
|
||||||
|
* Defaults to 1 if left undefined. */
|
||||||
|
#define configCHECK_HANDLER_INSTALLATION 1
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Definitions that include or exclude functionality. *************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Set the following configUSE_* constants to 1 to include the named feature in
|
||||||
|
* the build, or 0 to exclude the named feature from the build. */
|
||||||
|
#define configUSE_TASK_NOTIFICATIONS 1
|
||||||
|
#define configUSE_MUTEXES 1
|
||||||
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
|
#define configUSE_QUEUE_SETS 0
|
||||||
|
#define configUSE_APPLICATION_TASK_TAG 0
|
||||||
|
|
||||||
|
/* USE_POSIX_ERRNO enables the task global FreeRTOS_errno variable which will
|
||||||
|
* contain the most recent error for that task. */
|
||||||
|
#define configUSE_POSIX_ERRNO 0
|
||||||
|
|
||||||
|
/* Set the following INCLUDE_* constants to 1 to include the named API function,
|
||||||
|
* or 0 to exclude the named API function. Most linkers will remove unused
|
||||||
|
* functions even when the constant is 1. */
|
||||||
|
#define INCLUDE_vTaskPrioritySet 1
|
||||||
|
#define INCLUDE_uxTaskPriorityGet 1
|
||||||
|
#define INCLUDE_vTaskDelete 1
|
||||||
|
#define INCLUDE_vTaskSuspend 1
|
||||||
|
#define INCLUDE_vTaskDelayUntil 1
|
||||||
|
#define INCLUDE_vTaskDelay 1
|
||||||
|
#define INCLUDE_xTaskGetSchedulerState 1
|
||||||
|
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||||
|
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||||
|
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||||
|
#define INCLUDE_eTaskGetState 0
|
||||||
|
#define INCLUDE_xTimerPendFunctionCall 0
|
||||||
|
#define INCLUDE_xTaskAbortDelay 0
|
||||||
|
#define INCLUDE_xTaskGetHandle 0
|
||||||
|
#define INCLUDE_xTaskResumeFromISR 1
|
||||||
|
|
||||||
|
#endif /* FREERTOS_CONFIG_H */
|
7
examples/template_configuration/readme.md
Normal file
7
examples/template_configuration/readme.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Configuration support for FreeRTOS
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Every FreeRTOS project requires FreeRTOSConfig.h located in their include path. In this folder you will find a sample FreeRTOSConfig.h that will assist you in preparing the configuration for your application.
|
||||||
|
|
||||||
|
The FreeRTOSConfig.h in this folder is used in the minimal_freertos_example project provided and it not guaranteed to have the same configuration between updates.
|
1958
include/FreeRTOS.h
1958
include/FreeRTOS.h
File diff suppressed because it is too large
Load diff
|
@ -33,6 +33,14 @@
|
||||||
* This file implements atomic functions by disabling interrupts globally.
|
* This file implements atomic functions by disabling interrupts globally.
|
||||||
* Implementations with architecture specific atomic instructions can be
|
* Implementations with architecture specific atomic instructions can be
|
||||||
* provided under each compiler directory.
|
* provided under each compiler directory.
|
||||||
|
*
|
||||||
|
* The atomic interface can be used in FreeRTOS tasks on all FreeRTOS ports. It
|
||||||
|
* can also be used in Interrupt Service Routines (ISRs) on FreeRTOS ports that
|
||||||
|
* support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 1). The
|
||||||
|
* atomic interface must not be used in ISRs on FreeRTOS ports that do not
|
||||||
|
* support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 0)
|
||||||
|
* because ISRs on these ports cannot be interrupted and therefore, do not need
|
||||||
|
* atomics in ISRs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ATOMIC_H
|
#ifndef ATOMIC_H
|
||||||
|
@ -59,7 +67,7 @@
|
||||||
* ATOMIC_ENTER_CRITICAL().
|
* ATOMIC_ENTER_CRITICAL().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#if defined( portSET_INTERRUPT_MASK_FROM_ISR )
|
#if ( portHAS_NESTED_INTERRUPTS == 1 )
|
||||||
|
|
||||||
/* Nested interrupt scheme is supported in this port. */
|
/* Nested interrupt scheme is supported in this port. */
|
||||||
#define ATOMIC_ENTER_CRITICAL() \
|
#define ATOMIC_ENTER_CRITICAL() \
|
||||||
|
|
|
@ -47,8 +47,8 @@
|
||||||
typedef void * CoRoutineHandle_t;
|
typedef void * CoRoutineHandle_t;
|
||||||
|
|
||||||
/* Defines the prototype to which co-routine functions must conform. */
|
/* Defines the prototype to which co-routine functions must conform. */
|
||||||
typedef void (* crCOROUTINE_CODE)( CoRoutineHandle_t,
|
typedef void (* crCOROUTINE_CODE)( CoRoutineHandle_t xHandle,
|
||||||
UBaseType_t );
|
UBaseType_t uxIndex );
|
||||||
|
|
||||||
typedef struct corCoRoutineControlBlock
|
typedef struct corCoRoutineControlBlock
|
||||||
{
|
{
|
||||||
|
@ -746,6 +746,13 @@ void vCoRoutineAddToDelayedList( TickType_t xTicksToDelay,
|
||||||
*/
|
*/
|
||||||
BaseType_t xCoRoutineRemoveFromEventList( const List_t * pxEventList );
|
BaseType_t xCoRoutineRemoveFromEventList( const List_t * pxEventList );
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function resets the internal state of the coroutine module. It must be
|
||||||
|
* called by the application before restarting the scheduler.
|
||||||
|
*/
|
||||||
|
void vCoRoutineResetState( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,26 @@
|
||||||
/* FreeRTOS includes. */
|
/* FreeRTOS includes. */
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
|
|
||||||
|
/* The following bit fields convey control information in a task's event list
|
||||||
|
* item value. It is important they don't clash with the
|
||||||
|
* taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
|
||||||
|
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
|
||||||
|
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint16_t ) 0x0100U )
|
||||||
|
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint16_t ) 0x0200U )
|
||||||
|
#define eventWAIT_FOR_ALL_BITS ( ( uint16_t ) 0x0400U )
|
||||||
|
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint16_t ) 0xff00U )
|
||||||
|
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
|
||||||
|
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint32_t ) 0x01000000U )
|
||||||
|
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint32_t ) 0x02000000U )
|
||||||
|
#define eventWAIT_FOR_ALL_BITS ( ( uint32_t ) 0x04000000U )
|
||||||
|
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint32_t ) 0xff000000U )
|
||||||
|
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
|
||||||
|
#define eventCLEAR_EVENTS_ON_EXIT_BIT ( ( uint64_t ) 0x0100000000000000U )
|
||||||
|
#define eventUNBLOCKED_DUE_TO_BIT_SET ( ( uint64_t ) 0x0200000000000000U )
|
||||||
|
#define eventWAIT_FOR_ALL_BITS ( ( uint64_t ) 0x0400000000000000U )
|
||||||
|
#define eventEVENT_BITS_CONTROL_BYTES ( ( uint64_t ) 0xff00000000000000U )
|
||||||
|
#endif /* if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS ) */
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -119,6 +139,9 @@ typedef TickType_t EventBits_t;
|
||||||
* each event group has 56 usable bits (bit 0 to bit 53). The EventBits_t type
|
* each event group has 56 usable bits (bit 0 to bit 53). The EventBits_t type
|
||||||
* is used to store event bits within an event group.
|
* is used to store event bits within an event group.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupCreate()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @return If the event group was created then a handle to the event group is
|
* @return If the event group was created then a handle to the event group is
|
||||||
* returned. If there was insufficient FreeRTOS heap available to create the
|
* returned. If there was insufficient FreeRTOS heap available to create the
|
||||||
* event group then NULL is returned. See https://www.FreeRTOS.org/a00111.html
|
* event group then NULL is returned. See https://www.FreeRTOS.org/a00111.html
|
||||||
|
@ -176,6 +199,9 @@ typedef TickType_t EventBits_t;
|
||||||
* each event group has 56 usable bits (bit 0 to bit 53). The EventBits_t type
|
* each event group has 56 usable bits (bit 0 to bit 53). The EventBits_t type
|
||||||
* is used to store event bits within an event group.
|
* is used to store event bits within an event group.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupCreateStatic()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param pxEventGroupBuffer pxEventGroupBuffer must point to a variable of type
|
* @param pxEventGroupBuffer pxEventGroupBuffer must point to a variable of type
|
||||||
* StaticEventGroup_t, which will be then be used to hold the event group's data
|
* StaticEventGroup_t, which will be then be used to hold the event group's data
|
||||||
* structures, removing the need for the memory to be allocated dynamically.
|
* structures, removing the need for the memory to be allocated dynamically.
|
||||||
|
@ -218,6 +244,9 @@ typedef TickType_t EventBits_t;
|
||||||
*
|
*
|
||||||
* This function cannot be called from an interrupt.
|
* This function cannot be called from an interrupt.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupWaitBits()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param xEventGroup The event group in which the bits are being tested. The
|
* @param xEventGroup The event group in which the bits are being tested. The
|
||||||
* event group must have previously been created using a call to
|
* event group must have previously been created using a call to
|
||||||
* xEventGroupCreate().
|
* xEventGroupCreate().
|
||||||
|
@ -311,6 +340,9 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||||
* Clear bits within an event group. This function cannot be called from an
|
* Clear bits within an event group. This function cannot be called from an
|
||||||
* interrupt.
|
* interrupt.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupClearBits()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param xEventGroup The event group in which the bits are to be cleared.
|
* @param xEventGroup The event group in which the bits are to be cleared.
|
||||||
*
|
*
|
||||||
* @param uxBitsToClear A bitwise value that indicates the bit or bits to clear
|
* @param uxBitsToClear A bitwise value that indicates the bit or bits to clear
|
||||||
|
@ -441,6 +473,9 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
||||||
* Setting bits in an event group will automatically unblock tasks that are
|
* Setting bits in an event group will automatically unblock tasks that are
|
||||||
* blocked waiting for the bits.
|
* blocked waiting for the bits.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupSetBits()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param xEventGroup The event group in which the bits are to be set.
|
* @param xEventGroup The event group in which the bits are to be set.
|
||||||
*
|
*
|
||||||
* @param uxBitsToSet A bitwise value that indicates the bit or bits to set.
|
* @param uxBitsToSet A bitwise value that indicates the bit or bits to set.
|
||||||
|
@ -448,14 +483,11 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
||||||
* and bit 0 set uxBitsToSet to 0x09.
|
* and bit 0 set uxBitsToSet to 0x09.
|
||||||
*
|
*
|
||||||
* @return The value of the event group at the time the call to
|
* @return The value of the event group at the time the call to
|
||||||
* xEventGroupSetBits() returns. There are two reasons why the returned value
|
* xEventGroupSetBits() returns. Returned value might have the bits specified
|
||||||
* might have the bits specified by the uxBitsToSet parameter cleared. First,
|
* by the uxBitsToSet parameter cleared if setting a bit results in a task
|
||||||
* if setting a bit results in a task that was waiting for the bit leaving the
|
* that was waiting for the bit leaving the blocked state then it is possible
|
||||||
* blocked state then it is possible the bit will be cleared automatically
|
* the bit will be cleared automatically (see the xClearBitOnExit parameter
|
||||||
* (see the xClearBitOnExit parameter of xEventGroupWaitBits()). Second, any
|
* of xEventGroupWaitBits()).
|
||||||
* unblocked (or otherwise Ready state) task that has a priority above that of
|
|
||||||
* the task that called xEventGroupSetBits() will execute and may change the
|
|
||||||
* event group value before the call to xEventGroupSetBits() returns.
|
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -605,6 +637,9 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
|
||||||
* this case all the bits specified by uxBitsToWait will be automatically
|
* this case all the bits specified by uxBitsToWait will be automatically
|
||||||
* cleared before the function returns.
|
* cleared before the function returns.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupSync()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param xEventGroup The event group in which the bits are being tested. The
|
* @param xEventGroup The event group in which the bits are being tested. The
|
||||||
* event group must have previously been created using a call to
|
* event group must have previously been created using a call to
|
||||||
* xEventGroupCreate().
|
* xEventGroupCreate().
|
||||||
|
@ -723,6 +758,9 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||||
* Returns the current value of the bits in an event group. This function
|
* Returns the current value of the bits in an event group. This function
|
||||||
* cannot be used from an interrupt.
|
* cannot be used from an interrupt.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupGetBits()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param xEventGroup The event group being queried.
|
* @param xEventGroup The event group being queried.
|
||||||
*
|
*
|
||||||
* @return The event group bits at the time xEventGroupGetBits() was called.
|
* @return The event group bits at the time xEventGroupGetBits() was called.
|
||||||
|
@ -740,6 +778,9 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||||
*
|
*
|
||||||
* A version of xEventGroupGetBits() that can be called from an ISR.
|
* A version of xEventGroupGetBits() that can be called from an ISR.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupGetBitsFromISR()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param xEventGroup The event group being queried.
|
* @param xEventGroup The event group being queried.
|
||||||
*
|
*
|
||||||
* @return The event group bits at the time xEventGroupGetBitsFromISR() was called.
|
* @return The event group bits at the time xEventGroupGetBitsFromISR() was called.
|
||||||
|
@ -759,6 +800,9 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEG
|
||||||
* xEventGroupCreate(). Tasks that are blocked on the event group will be
|
* xEventGroupCreate(). Tasks that are blocked on the event group will be
|
||||||
* unblocked and obtain 0 as the event group's value.
|
* unblocked and obtain 0 as the event group's value.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for vEventGroupDelete()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param xEventGroup The event group being deleted.
|
* @param xEventGroup The event group being deleted.
|
||||||
*/
|
*/
|
||||||
void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
||||||
|
@ -773,6 +817,9 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
||||||
* Retrieve a pointer to a statically created event groups's data structure
|
* Retrieve a pointer to a statically created event groups's data structure
|
||||||
* buffer. It is the same buffer that is supplied at the time of creation.
|
* buffer. It is the same buffer that is supplied at the time of creation.
|
||||||
*
|
*
|
||||||
|
* The configUSE_EVENT_GROUPS configuration constant must be set to 1 for xEventGroupGetStaticBuffer()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
* @param xEventGroup The event group for which to retrieve the buffer.
|
* @param xEventGroup The event group for which to retrieve the buffer.
|
||||||
*
|
*
|
||||||
* @param ppxEventGroupBuffer Used to return a pointer to the event groups's
|
* @param ppxEventGroupBuffer Used to return a pointer to the event groups's
|
||||||
|
@ -787,9 +834,9 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* For internal use only. */
|
/* For internal use only. */
|
||||||
void vEventGroupSetBitsCallback( void * pvEventGroup,
|
void vEventGroupSetBitsCallback( void * pvEventGroup,
|
||||||
const uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION;
|
uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION;
|
||||||
void vEventGroupClearBitsCallback( void * pvEventGroup,
|
void vEventGroupClearBitsCallback( void * pvEventGroup,
|
||||||
const uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;
|
uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
||||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||||
|
|
|
@ -151,7 +151,7 @@ struct xLIST_ITEM
|
||||||
struct xLIST * configLIST_VOLATILE pxContainer; /**< Pointer to the list in which this list item is placed (if any). */
|
struct xLIST * configLIST_VOLATILE pxContainer; /**< Pointer to the list in which this list item is placed (if any). */
|
||||||
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
};
|
};
|
||||||
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
typedef struct xLIST_ITEM ListItem_t;
|
||||||
|
|
||||||
#if ( configUSE_MINI_LIST_ITEM == 1 )
|
#if ( configUSE_MINI_LIST_ITEM == 1 )
|
||||||
struct xMINI_LIST_ITEM
|
struct xMINI_LIST_ITEM
|
||||||
|
@ -172,7 +172,7 @@ typedef struct xLIST_ITEM ListItem_t; /* For some reason lint
|
||||||
typedef struct xLIST
|
typedef struct xLIST
|
||||||
{
|
{
|
||||||
listFIRST_LIST_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
listFIRST_LIST_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
volatile UBaseType_t uxNumberOfItems;
|
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
|
||||||
ListItem_t * configLIST_VOLATILE pxIndex; /**< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
ListItem_t * configLIST_VOLATILE pxIndex; /**< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||||
MiniListItem_t xListEnd; /**< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
MiniListItem_t xListEnd; /**< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||||
listSECOND_LIST_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
listSECOND_LIST_INTEGRITY_CHECK_VALUE /**< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
|
@ -282,6 +282,7 @@ typedef struct xLIST
|
||||||
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
||||||
* \ingroup LinkedList
|
* \ingroup LinkedList
|
||||||
*/
|
*/
|
||||||
|
#if ( configNUMBER_OF_CORES == 1 )
|
||||||
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||||
do { \
|
do { \
|
||||||
List_t * const pxConstList = ( pxList ); \
|
List_t * const pxConstList = ( pxList ); \
|
||||||
|
@ -294,6 +295,13 @@ typedef struct xLIST
|
||||||
} \
|
} \
|
||||||
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
|
|
||||||
|
/* This function is not required in SMP. FreeRTOS SMP scheduler doesn't use
|
||||||
|
* pxIndex and it should always point to the xListEnd. Not defining this macro
|
||||||
|
* here to prevent updating pxIndex.
|
||||||
|
*/
|
||||||
|
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Version of uxListRemove() that does not return a value. Provided as a slight
|
* Version of uxListRemove() that does not return a value. Provided as a slight
|
||||||
|
@ -326,7 +334,7 @@ typedef struct xLIST
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
( pxItemToRemove )->pxContainer = NULL; \
|
( pxItemToRemove )->pxContainer = NULL; \
|
||||||
( pxList->uxNumberOfItems )--; \
|
( ( pxList )->uxNumberOfItems ) = ( UBaseType_t ) ( ( ( pxList )->uxNumberOfItems ) - 1U ); \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -373,7 +381,7 @@ typedef struct xLIST
|
||||||
/* Remember which list the item is in. */ \
|
/* Remember which list the item is in. */ \
|
||||||
( pxNewListItem )->pxContainer = ( pxList ); \
|
( pxNewListItem )->pxContainer = ( pxList ); \
|
||||||
\
|
\
|
||||||
( ( pxList )->uxNumberOfItems )++; \
|
( ( pxList )->uxNumberOfItems ) = ( UBaseType_t ) ( ( ( pxList )->uxNumberOfItems ) + 1U ); \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -43,12 +43,12 @@
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xMessageBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xMessageBufferRead()) inside a critical section and set the receive
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* timeout to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
* Message buffers hold variable length messages. To enable that, when a
|
* Message buffers hold variable length messages. To enable that, when a
|
||||||
* message is written to the message buffer an additional sizeof( size_t ) bytes
|
* message is written to the message buffer an additional sizeof( size_t ) bytes
|
||||||
|
@ -100,6 +100,8 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
*
|
*
|
||||||
* configSUPPORT_DYNAMIC_ALLOCATION must be set to 1 or left undefined in
|
* configSUPPORT_DYNAMIC_ALLOCATION must be set to 1 or left undefined in
|
||||||
* FreeRTOSConfig.h for xMessageBufferCreate() to be available.
|
* FreeRTOSConfig.h for xMessageBufferCreate() to be available.
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferCreate() to be available.
|
||||||
*
|
*
|
||||||
* @param xBufferSizeBytes The total number of bytes (not messages) the message
|
* @param xBufferSizeBytes The total number of bytes (not messages) the message
|
||||||
* buffer will be able to hold at any one time. When a message is written to
|
* buffer will be able to hold at any one time. When a message is written to
|
||||||
|
@ -156,11 +158,11 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferCreate( xBufferSizeBytes ) \
|
#define xMessageBufferCreate( xBufferSizeBytes ) \
|
||||||
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( size_t ) 0, pdTRUE, NULL, NULL )
|
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( size_t ) 0, sbTYPE_MESSAGE_BUFFER, NULL, NULL )
|
||||||
|
|
||||||
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||||
#define xMessageBufferCreateWithCallback( xBufferSizeBytes, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
#define xMessageBufferCreateWithCallback( xBufferSizeBytes, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
||||||
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( size_t ) 0, pdTRUE, ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( size_t ) 0, sbTYPE_MESSAGE_BUFFER, ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,6 +176,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* Creates a new message buffer using statically allocated memory. See
|
* Creates a new message buffer using statically allocated memory. See
|
||||||
* xMessageBufferCreate() for a version that uses dynamically allocated memory.
|
* xMessageBufferCreate() for a version that uses dynamically allocated memory.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferCreateStatic() to be available.
|
||||||
|
*
|
||||||
* @param xBufferSizeBytes The size, in bytes, of the buffer pointed to by the
|
* @param xBufferSizeBytes The size, in bytes, of the buffer pointed to by the
|
||||||
* pucMessageBufferStorageArea parameter. When a message is written to the
|
* pucMessageBufferStorageArea parameter. When a message is written to the
|
||||||
* message buffer an additional sizeof( size_t ) bytes are also written to store
|
* message buffer an additional sizeof( size_t ) bytes are also written to store
|
||||||
|
@ -238,11 +243,11 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferCreateStatic( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer ) \
|
#define xMessageBufferCreateStatic( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer ) \
|
||||||
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), 0, pdTRUE, ( pucMessageBufferStorageArea ), ( pxStaticMessageBuffer ), NULL, NULL )
|
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), 0, sbTYPE_MESSAGE_BUFFER, ( pucMessageBufferStorageArea ), ( pxStaticMessageBuffer ), NULL, NULL )
|
||||||
|
|
||||||
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||||
#define xMessageBufferCreateStaticWithCallback( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
#define xMessageBufferCreateStaticWithCallback( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
||||||
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), 0, pdTRUE, ( pucMessageBufferStorageArea ), ( pxStaticMessageBuffer ), ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), 0, sbTYPE_MESSAGE_BUFFER, ( pucMessageBufferStorageArea ), ( pxStaticMessageBuffer ), ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,6 +263,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* buffer and storage area buffer. These are the same buffers that are supplied
|
* buffer and storage area buffer. These are the same buffers that are supplied
|
||||||
* at the time of creation.
|
* at the time of creation.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferGetStaticBuffers() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The message buffer for which to retrieve the buffers.
|
* @param xMessageBuffer The message buffer for which to retrieve the buffers.
|
||||||
*
|
*
|
||||||
* @param ppucMessageBufferStorageArea Used to return a pointer to the
|
* @param ppucMessageBufferStorageArea Used to return a pointer to the
|
||||||
|
@ -298,17 +306,20 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xMessageBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xMessageBufferRead()) inside a critical section and set the receive
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* block time to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
* Use xMessageBufferSend() to write to a message buffer from a task. Use
|
* Use xMessageBufferSend() to write to a message buffer from a task. Use
|
||||||
* xMessageBufferSendFromISR() to write to a message buffer from an interrupt
|
* xMessageBufferSendFromISR() to write to a message buffer from an interrupt
|
||||||
* service routine (ISR).
|
* service routine (ISR).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferSend() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer to which a message is
|
* @param xMessageBuffer The handle of the message buffer to which a message is
|
||||||
* being sent.
|
* being sent.
|
||||||
*
|
*
|
||||||
|
@ -398,17 +409,20 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xMessageBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xMessageBufferRead()) inside a critical section and set the receive
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* block time to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
* Use xMessageBufferSend() to write to a message buffer from a task. Use
|
* Use xMessageBufferSend() to write to a message buffer from a task. Use
|
||||||
* xMessageBufferSendFromISR() to write to a message buffer from an interrupt
|
* xMessageBufferSendFromISR() to write to a message buffer from an interrupt
|
||||||
* service routine (ISR).
|
* service routine (ISR).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferSendFromISR() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer to which a message is
|
* @param xMessageBuffer The handle of the message buffer to which a message is
|
||||||
* being sent.
|
* being sent.
|
||||||
*
|
*
|
||||||
|
@ -502,17 +516,20 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xMessageBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xMessageBufferRead()) inside a critical section and set the receive
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* block time to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
* Use xMessageBufferReceive() to read from a message buffer from a task. Use
|
* Use xMessageBufferReceive() to read from a message buffer from a task. Use
|
||||||
* xMessageBufferReceiveFromISR() to read from a message buffer from an
|
* xMessageBufferReceiveFromISR() to read from a message buffer from an
|
||||||
* interrupt service routine (ISR).
|
* interrupt service routine (ISR).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferReceive() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer from which a message
|
* @param xMessageBuffer The handle of the message buffer from which a message
|
||||||
* is being received.
|
* is being received.
|
||||||
*
|
*
|
||||||
|
@ -593,17 +610,20 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xMessageBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xMessageBufferRead()) inside a critical section and set the receive
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* block time to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
* Use xMessageBufferReceive() to read from a message buffer from a task. Use
|
* Use xMessageBufferReceive() to read from a message buffer from a task. Use
|
||||||
* xMessageBufferReceiveFromISR() to read from a message buffer from an
|
* xMessageBufferReceiveFromISR() to read from a message buffer from an
|
||||||
* interrupt service routine (ISR).
|
* interrupt service routine (ISR).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferReceiveFromISR() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer from which a message
|
* @param xMessageBuffer The handle of the message buffer from which a message
|
||||||
* is being received.
|
* is being received.
|
||||||
*
|
*
|
||||||
|
@ -687,6 +707,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* A message buffer handle must not be used after the message buffer has been
|
* A message buffer handle must not be used after the message buffer has been
|
||||||
* deleted.
|
* deleted.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* vMessageBufferDelete() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer to be deleted.
|
* @param xMessageBuffer The handle of the message buffer to be deleted.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -703,6 +726,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* cannot accept any more messages, of any size, until space is made available
|
* cannot accept any more messages, of any size, until space is made available
|
||||||
* by a message being removed from the message buffer.
|
* by a message being removed from the message buffer.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferIsFull() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer being queried.
|
* @param xMessageBuffer The handle of the message buffer being queried.
|
||||||
*
|
*
|
||||||
* @return If the message buffer referenced by xMessageBuffer is full then
|
* @return If the message buffer referenced by xMessageBuffer is full then
|
||||||
|
@ -719,6 +745,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
*
|
*
|
||||||
* Tests to see if a message buffer is empty (does not contain any messages).
|
* Tests to see if a message buffer is empty (does not contain any messages).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferIsEmpty() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer being queried.
|
* @param xMessageBuffer The handle of the message buffer being queried.
|
||||||
*
|
*
|
||||||
* @return If the message buffer referenced by xMessageBuffer is empty then
|
* @return If the message buffer referenced by xMessageBuffer is empty then
|
||||||
|
@ -739,6 +768,13 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
*
|
*
|
||||||
* A message buffer can only be reset if there are no tasks blocked on it.
|
* A message buffer can only be reset if there are no tasks blocked on it.
|
||||||
*
|
*
|
||||||
|
* Use xMessageBufferReset() to reset a message buffer from a task.
|
||||||
|
* Use xMessageBufferResetFromISR() to reset a message buffer from an
|
||||||
|
* interrupt service routine (ISR).
|
||||||
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferReset() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer being reset.
|
* @param xMessageBuffer The handle of the message buffer being reset.
|
||||||
*
|
*
|
||||||
* @return If the message buffer was reset then pdPASS is returned. If the
|
* @return If the message buffer was reset then pdPASS is returned. If the
|
||||||
|
@ -753,6 +789,38 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
xStreamBufferReset( xMessageBuffer )
|
xStreamBufferReset( xMessageBuffer )
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* message_buffer.h
|
||||||
|
* @code{c}
|
||||||
|
* BaseType_t xMessageBufferResetFromISR( MessageBufferHandle_t xMessageBuffer );
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* An interrupt safe version of the API function that resets the message buffer.
|
||||||
|
* Resets a message buffer to its initial empty state, discarding any message it
|
||||||
|
* contained.
|
||||||
|
*
|
||||||
|
* A message buffer can only be reset if there are no tasks blocked on it.
|
||||||
|
*
|
||||||
|
* Use xMessageBufferReset() to reset a message buffer from a task.
|
||||||
|
* Use xMessageBufferResetFromISR() to reset a message buffer from an
|
||||||
|
* interrupt service routine (ISR).
|
||||||
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferResetFromISR() to be available.
|
||||||
|
*
|
||||||
|
* @param xMessageBuffer The handle of the message buffer being reset.
|
||||||
|
*
|
||||||
|
* @return If the message buffer was reset then pdPASS is returned. If the
|
||||||
|
* message buffer could not be reset because either there was a task blocked on
|
||||||
|
* the message queue to wait for space to become available, or to wait for a
|
||||||
|
* a message to be available, then pdFAIL is returned.
|
||||||
|
*
|
||||||
|
* \defgroup xMessageBufferResetFromISR xMessageBufferResetFromISR
|
||||||
|
* \ingroup MessageBufferManagement
|
||||||
|
*/
|
||||||
|
#define xMessageBufferResetFromISR( xMessageBuffer ) \
|
||||||
|
xStreamBufferResetFromISR( xMessageBuffer )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -760,6 +828,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* @endcode
|
* @endcode
|
||||||
* Returns the number of bytes of free space in the message buffer.
|
* Returns the number of bytes of free space in the message buffer.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferSpaceAvailable() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer being queried.
|
* @param xMessageBuffer The handle of the message buffer being queried.
|
||||||
*
|
*
|
||||||
* @return The number of bytes that can be written to the message buffer before
|
* @return The number of bytes that can be written to the message buffer before
|
||||||
|
@ -786,6 +857,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* Useful if xMessageBufferReceive() returned 0 because the size of the buffer
|
* Useful if xMessageBufferReceive() returned 0 because the size of the buffer
|
||||||
* passed into xMessageBufferReceive() was too small to hold the next message.
|
* passed into xMessageBufferReceive() was too small to hold the next message.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferNextLengthBytes() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the message buffer being queried.
|
* @param xMessageBuffer The handle of the message buffer being queried.
|
||||||
*
|
*
|
||||||
* @return The length (in bytes) of the next message in the message buffer, or 0
|
* @return The length (in bytes) of the next message in the message buffer, or 0
|
||||||
|
@ -795,7 +869,7 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* \ingroup MessageBufferManagement
|
* \ingroup MessageBufferManagement
|
||||||
*/
|
*/
|
||||||
#define xMessageBufferNextLengthBytes( xMessageBuffer ) \
|
#define xMessageBufferNextLengthBytes( xMessageBuffer ) \
|
||||||
xStreamBufferNextMessageLengthBytes( xMessageBuffer ) PRIVILEGED_FUNCTION;
|
xStreamBufferNextMessageLengthBytes( xMessageBuffer )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message_buffer.h
|
* message_buffer.h
|
||||||
|
@ -817,6 +891,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for
|
* See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for
|
||||||
* additional information.
|
* additional information.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferSendCompletedFromISR() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the stream buffer to which data was
|
* @param xMessageBuffer The handle of the stream buffer to which data was
|
||||||
* written.
|
* written.
|
||||||
*
|
*
|
||||||
|
@ -858,6 +935,9 @@ typedef StreamBufferHandle_t MessageBufferHandle_t;
|
||||||
* See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for
|
* See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for
|
||||||
* additional information.
|
* additional information.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xMessageBufferReceiveCompletedFromISR() to be available.
|
||||||
|
*
|
||||||
* @param xMessageBuffer The handle of the stream buffer from which data was
|
* @param xMessageBuffer The handle of the stream buffer from which data was
|
||||||
* read.
|
* read.
|
||||||
*
|
*
|
||||||
|
|
|
@ -38,6 +38,42 @@
|
||||||
#ifndef MPU_PROTOTYPES_H
|
#ifndef MPU_PROTOTYPES_H
|
||||||
#define MPU_PROTOTYPES_H
|
#define MPU_PROTOTYPES_H
|
||||||
|
|
||||||
|
typedef struct xTaskGenericNotifyParams
|
||||||
|
{
|
||||||
|
TaskHandle_t xTaskToNotify;
|
||||||
|
UBaseType_t uxIndexToNotify;
|
||||||
|
uint32_t ulValue;
|
||||||
|
eNotifyAction eAction;
|
||||||
|
uint32_t * pulPreviousNotificationValue;
|
||||||
|
} xTaskGenericNotifyParams_t;
|
||||||
|
|
||||||
|
typedef struct xTaskGenericNotifyWaitParams
|
||||||
|
{
|
||||||
|
UBaseType_t uxIndexToWaitOn;
|
||||||
|
uint32_t ulBitsToClearOnEntry;
|
||||||
|
uint32_t ulBitsToClearOnExit;
|
||||||
|
uint32_t * pulNotificationValue;
|
||||||
|
TickType_t xTicksToWait;
|
||||||
|
} xTaskGenericNotifyWaitParams_t;
|
||||||
|
|
||||||
|
typedef struct xTimerGenericCommandFromTaskParams
|
||||||
|
{
|
||||||
|
TimerHandle_t xTimer;
|
||||||
|
BaseType_t xCommandID;
|
||||||
|
TickType_t xOptionalValue;
|
||||||
|
BaseType_t * pxHigherPriorityTaskWoken;
|
||||||
|
TickType_t xTicksToWait;
|
||||||
|
} xTimerGenericCommandFromTaskParams_t;
|
||||||
|
|
||||||
|
typedef struct xEventGroupWaitBitsParams
|
||||||
|
{
|
||||||
|
EventGroupHandle_t xEventGroup;
|
||||||
|
EventBits_t uxBitsToWaitFor;
|
||||||
|
BaseType_t xClearOnExit;
|
||||||
|
BaseType_t xWaitForAllBits;
|
||||||
|
TickType_t xTicksToWait;
|
||||||
|
} xEventGroupWaitBitsParams_t;
|
||||||
|
|
||||||
/* MPU versions of task.h API functions. */
|
/* MPU versions of task.h API functions. */
|
||||||
void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
|
BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
|
||||||
|
@ -53,7 +89,6 @@ void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL;
|
void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL;
|
||||||
TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL;
|
TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL;
|
||||||
char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) FREERTOS_SYSTEM_CALL;
|
|
||||||
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask,
|
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask,
|
||||||
|
@ -77,11 +112,13 @@ BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify,
|
||||||
uint32_t ulValue,
|
uint32_t ulValue,
|
||||||
eNotifyAction eAction,
|
eNotifyAction eAction,
|
||||||
uint32_t * pulPreviousNotificationValue ) FREERTOS_SYSTEM_CALL;
|
uint32_t * pulPreviousNotificationValue ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn,
|
BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn,
|
||||||
uint32_t ulBitsToClearOnEntry,
|
uint32_t ulBitsToClearOnEntry,
|
||||||
uint32_t ulBitsToClearOnExit,
|
uint32_t ulBitsToClearOnExit,
|
||||||
uint32_t * pulNotificationValue,
|
uint32_t * pulNotificationValue,
|
||||||
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
|
||||||
uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn,
|
uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn,
|
||||||
BaseType_t xClearCountOnExit,
|
BaseType_t xClearCountOnExit,
|
||||||
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
|
@ -99,15 +136,46 @@ BaseType_t MPU_xTaskGetSchedulerState( void ) FREERTOS_SYSTEM_CALL;
|
||||||
/* Privileged only wrappers for Task APIs. These are needed so that
|
/* Privileged only wrappers for Task APIs. These are needed so that
|
||||||
* the application can use opaque handles maintained in mpu_wrappers.c
|
* the application can use opaque handles maintained in mpu_wrappers.c
|
||||||
* with all the APIs. */
|
* with all the APIs. */
|
||||||
|
#if ( configUSE_MPU_WRAPPERS_V1 == 1 )
|
||||||
|
|
||||||
BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode,
|
BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode,
|
||||||
const char * const pcName,
|
const char * const pcName,
|
||||||
const uint16_t usStackDepth,
|
const configSTACK_DEPTH_TYPE uxStackDepth,
|
||||||
|
void * const pvParameters,
|
||||||
|
UBaseType_t uxPriority,
|
||||||
|
TaskHandle_t * const pxCreatedTask ) FREERTOS_SYSTEM_CALL;
|
||||||
|
TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
|
||||||
|
const char * const pcName,
|
||||||
|
const configSTACK_DEPTH_TYPE uxStackDepth,
|
||||||
|
void * const pvParameters,
|
||||||
|
UBaseType_t uxPriority,
|
||||||
|
StackType_t * const puxStackBuffer,
|
||||||
|
StaticTask_t * const pxTaskBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
|
void MPU_vTaskDelete( TaskHandle_t xTaskToDelete ) FREERTOS_SYSTEM_CALL;
|
||||||
|
void MPU_vTaskPrioritySet( TaskHandle_t xTask,
|
||||||
|
UBaseType_t uxNewPriority ) FREERTOS_SYSTEM_CALL;
|
||||||
|
TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask,
|
||||||
|
void * pvParameter ) FREERTOS_SYSTEM_CALL;
|
||||||
|
void MPU_vTaskGetRunTimeStatistics( char * pcWriteBuffer,
|
||||||
|
size_t uxBufferLength ) FREERTOS_SYSTEM_CALL;
|
||||||
|
void MPU_vTaskListTasks( char * pcWriteBuffer,
|
||||||
|
size_t uxBufferLength ) FREERTOS_SYSTEM_CALL;
|
||||||
|
void MPU_vTaskSuspendAll( void ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xTaskResumeAll( void ) FREERTOS_SYSTEM_CALL;
|
||||||
|
|
||||||
|
#else /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
|
BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode,
|
||||||
|
const char * const pcName,
|
||||||
|
const configSTACK_DEPTH_TYPE uxStackDepth,
|
||||||
void * const pvParameters,
|
void * const pvParameters,
|
||||||
UBaseType_t uxPriority,
|
UBaseType_t uxPriority,
|
||||||
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
|
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
|
||||||
TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
|
TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
|
||||||
const char * const pcName,
|
const char * const pcName,
|
||||||
const uint32_t ulStackDepth,
|
const configSTACK_DEPTH_TYPE uxStackDepth,
|
||||||
void * const pvParameters,
|
void * const pvParameters,
|
||||||
UBaseType_t uxPriority,
|
UBaseType_t uxPriority,
|
||||||
StackType_t * const puxStackBuffer,
|
StackType_t * const puxStackBuffer,
|
||||||
|
@ -118,16 +186,22 @@ void MPU_vTaskPrioritySet( TaskHandle_t xTask,
|
||||||
TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION;
|
TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask,
|
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask,
|
||||||
void * pvParameter ) PRIVILEGED_FUNCTION;
|
void * pvParameter ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
|
char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
|
BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
|
||||||
TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
|
TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition,
|
BaseType_t MPU_xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition,
|
||||||
TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
|
TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
|
||||||
void vTaskAllocateMPURegions( TaskHandle_t xTaskToModify,
|
void MPU_vTaskAllocateMPURegions( TaskHandle_t xTaskToModify,
|
||||||
const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION;
|
const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xTaskGetStaticBuffers( TaskHandle_t xTask,
|
BaseType_t MPU_xTaskGetStaticBuffers( TaskHandle_t xTask,
|
||||||
StackType_t ** ppuxStackBuffer,
|
StackType_t ** ppuxStackBuffer,
|
||||||
StaticTask_t ** ppxTaskBuffer ) PRIVILEGED_FUNCTION;
|
StaticTask_t ** ppxTaskBuffer ) PRIVILEGED_FUNCTION;
|
||||||
UBaseType_t MPU_uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
UBaseType_t MPU_uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||||
|
UBaseType_t MPU_uxTaskBasePriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||||
|
UBaseType_t MPU_uxTaskBasePriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
|
BaseType_t MPU_xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
|
||||||
TaskHookFunction_t MPU_xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
TaskHookFunction_t MPU_xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify,
|
BaseType_t MPU_xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify,
|
||||||
|
@ -175,6 +249,36 @@ uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
/* Privileged only wrappers for Queue APIs. These are needed so that
|
/* Privileged only wrappers for Queue APIs. These are needed so that
|
||||||
* the application can use opaque handles maintained in mpu_wrappers.c
|
* the application can use opaque handles maintained in mpu_wrappers.c
|
||||||
* with all the APIs. */
|
* with all the APIs. */
|
||||||
|
#if ( configUSE_MPU_WRAPPERS_V1 == 1 )
|
||||||
|
|
||||||
|
void MPU_vQueueDelete( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
|
QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL;
|
||||||
|
QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType,
|
||||||
|
StaticQueue_t * pxStaticQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
|
QueueHandle_t MPU_xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount,
|
||||||
|
const UBaseType_t uxInitialCount ) FREERTOS_SYSTEM_CALL;
|
||||||
|
QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
|
||||||
|
const UBaseType_t uxInitialCount,
|
||||||
|
StaticQueue_t * pxStaticQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
|
QueueHandle_t MPU_xQueueGenericCreate( const UBaseType_t uxQueueLength,
|
||||||
|
const UBaseType_t uxItemSize,
|
||||||
|
const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL;
|
||||||
|
QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength,
|
||||||
|
const UBaseType_t uxItemSize,
|
||||||
|
uint8_t * pucQueueStorage,
|
||||||
|
StaticQueue_t * pxStaticQueue,
|
||||||
|
const uint8_t ucQueueType ) FREERTOS_SYSTEM_CALL;
|
||||||
|
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) FREERTOS_SYSTEM_CALL;
|
||||||
|
QueueSetHandle_t MPU_xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
|
||||||
|
uint8_t * pucQueueStorage,
|
||||||
|
StaticQueue_t * pxStaticQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
||||||
|
QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,
|
||||||
|
BaseType_t xNewQueue ) FREERTOS_SYSTEM_CALL;
|
||||||
|
|
||||||
|
#else /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
void MPU_vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
void MPU_vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||||
QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType,
|
QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType,
|
||||||
|
@ -193,10 +297,16 @@ QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength,
|
||||||
StaticQueue_t * pxStaticQueue,
|
StaticQueue_t * pxStaticQueue,
|
||||||
const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||||
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
|
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
|
||||||
|
QueueSetHandle_t MPU_xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
|
||||||
|
uint8_t * pucQueueStorage,
|
||||||
|
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
||||||
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,
|
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,
|
||||||
BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
|
BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
BaseType_t MPU_xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
|
BaseType_t MPU_xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
|
||||||
uint8_t ** ppucQueueStorage,
|
uint8_t ** ppucQueueStorage,
|
||||||
StaticQueue_t ** ppxStaticQueue ) PRIVILEGED_FUNCTION;
|
StaticQueue_t ** ppxStaticQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
@ -223,14 +333,15 @@ void MPU_vTimerSetTimerID( TimerHandle_t xTimer,
|
||||||
void * pvNewID ) FREERTOS_SYSTEM_CALL;
|
void * pvNewID ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL;
|
TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
|
BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
|
||||||
const BaseType_t xCommandID,
|
const BaseType_t xCommandID,
|
||||||
const TickType_t xOptionalValue,
|
const TickType_t xOptionalValue,
|
||||||
BaseType_t * const pxHigherPriorityTaskWoken,
|
BaseType_t * const pxHigherPriorityTaskWoken,
|
||||||
const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
|
||||||
const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vTimerSetReloadMode( TimerHandle_t xTimer,
|
void MPU_vTimerSetReloadMode( TimerHandle_t xTimer,
|
||||||
const UBaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL;
|
const BaseType_t xAutoReload ) FREERTOS_SYSTEM_CALL;
|
||||||
BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
|
@ -241,17 +352,22 @@ TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
|
||||||
* with all the APIs. */
|
* with all the APIs. */
|
||||||
TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName,
|
TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName,
|
||||||
const TickType_t xTimerPeriodInTicks,
|
const TickType_t xTimerPeriodInTicks,
|
||||||
const UBaseType_t uxAutoReload,
|
const BaseType_t xAutoReload,
|
||||||
void * const pvTimerID,
|
void * const pvTimerID,
|
||||||
TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION;
|
TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION;
|
||||||
TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName,
|
TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName,
|
||||||
const TickType_t xTimerPeriodInTicks,
|
const TickType_t xTimerPeriodInTicks,
|
||||||
const UBaseType_t uxAutoReload,
|
const BaseType_t xAutoReload,
|
||||||
void * const pvTimerID,
|
void * const pvTimerID,
|
||||||
TimerCallbackFunction_t pxCallbackFunction,
|
TimerCallbackFunction_t pxCallbackFunction,
|
||||||
StaticTimer_t * pxTimerBuffer ) PRIVILEGED_FUNCTION;
|
StaticTimer_t * pxTimerBuffer ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xTimerGetStaticBuffer( TimerHandle_t xTimer,
|
BaseType_t MPU_xTimerGetStaticBuffer( TimerHandle_t xTimer,
|
||||||
StaticTimer_t ** ppxTimerBuffer ) PRIVILEGED_FUNCTION;
|
StaticTimer_t ** ppxTimerBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
BaseType_t MPU_xTimerGenericCommandFromISR( TimerHandle_t xTimer,
|
||||||
|
const BaseType_t xCommandID,
|
||||||
|
const TickType_t xOptionalValue,
|
||||||
|
BaseType_t * const pxHigherPriorityTaskWoken,
|
||||||
|
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* MPU versions of event_group.h API functions. */
|
/* MPU versions of event_group.h API functions. */
|
||||||
EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||||
|
@ -259,6 +375,7 @@ EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
|
||||||
const BaseType_t xClearOnExit,
|
const BaseType_t xClearOnExit,
|
||||||
const BaseType_t xWaitForAllBits,
|
const BaseType_t xWaitForAllBits,
|
||||||
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
|
||||||
|
EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
|
||||||
EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup,
|
||||||
const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL;
|
const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL;
|
||||||
EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup,
|
EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup,
|
||||||
|
@ -271,14 +388,25 @@ EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup,
|
||||||
UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) FREERTOS_SYSTEM_CALL;
|
UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) FREERTOS_SYSTEM_CALL;
|
||||||
void MPU_vEventGroupSetNumber( void * xEventGroup,
|
void MPU_vEventGroupSetNumber( void * xEventGroup,
|
||||||
UBaseType_t uxEventGroupNumber ) FREERTOS_SYSTEM_CALL;
|
UBaseType_t uxEventGroupNumber ) FREERTOS_SYSTEM_CALL;
|
||||||
#endif /* ( configUSE_TRACE_FACILITY == 1 )*/
|
#endif /* #if ( configUSE_TRACE_FACILITY == 1 ) */
|
||||||
|
|
||||||
/* Privileged only wrappers for Event Group APIs. These are needed so that
|
/* Privileged only wrappers for Event Group APIs. These are needed so that
|
||||||
* the application can use opaque handles maintained in mpu_wrappers.c
|
* the application can use opaque handles maintained in mpu_wrappers.c
|
||||||
* with all the APIs. */
|
* with all the APIs. */
|
||||||
|
#if ( configUSE_MPU_WRAPPERS_V1 == 1 )
|
||||||
|
|
||||||
|
EventGroupHandle_t MPU_xEventGroupCreate( void ) FREERTOS_SYSTEM_CALL;
|
||||||
|
EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
|
void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) FREERTOS_SYSTEM_CALL;
|
||||||
|
|
||||||
|
#else /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
EventGroupHandle_t MPU_xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
EventGroupHandle_t MPU_xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
||||||
EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) PRIVILEGED_FUNCTION;
|
EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) PRIVILEGED_FUNCTION;
|
||||||
void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
BaseType_t MPU_xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
|
BaseType_t MPU_xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
|
||||||
StaticEventGroup_t ** ppxEventGroupBuffer ) PRIVILEGED_FUNCTION;
|
StaticEventGroup_t ** ppxEventGroupBuffer ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
|
BaseType_t MPU_xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
|
||||||
|
@ -308,20 +436,42 @@ size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuff
|
||||||
/* Privileged only wrappers for Stream Buffer APIs. These are needed so that
|
/* Privileged only wrappers for Stream Buffer APIs. These are needed so that
|
||||||
* the application can use opaque handles maintained in mpu_wrappers.c
|
* the application can use opaque handles maintained in mpu_wrappers.c
|
||||||
* with all the APIs. */
|
* with all the APIs. */
|
||||||
|
#if ( configUSE_MPU_WRAPPERS_V1 == 1 )
|
||||||
|
|
||||||
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
|
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
|
||||||
size_t xTriggerLevelBytes,
|
size_t xTriggerLevelBytes,
|
||||||
BaseType_t xIsMessageBuffer,
|
BaseType_t xStreamBufferType,
|
||||||
|
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||||
|
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) FREERTOS_SYSTEM_CALL;
|
||||||
|
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
|
||||||
|
size_t xTriggerLevelBytes,
|
||||||
|
BaseType_t xStreamBufferType,
|
||||||
|
uint8_t * const pucStreamBufferStorageArea,
|
||||||
|
StaticStreamBuffer_t * const pxStaticStreamBuffer,
|
||||||
|
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||||
|
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) FREERTOS_SYSTEM_CALL;
|
||||||
|
void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
|
BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
|
||||||
|
|
||||||
|
#else /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
|
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
|
||||||
|
size_t xTriggerLevelBytes,
|
||||||
|
BaseType_t xStreamBufferType,
|
||||||
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||||
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
|
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
|
||||||
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
|
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
|
||||||
size_t xTriggerLevelBytes,
|
size_t xTriggerLevelBytes,
|
||||||
BaseType_t xIsMessageBuffer,
|
BaseType_t xStreamBufferType,
|
||||||
uint8_t * const pucStreamBufferStorageArea,
|
uint8_t * const pucStreamBufferStorageArea,
|
||||||
StaticStreamBuffer_t * const pxStaticStreamBuffer,
|
StaticStreamBuffer_t * const pxStaticStreamBuffer,
|
||||||
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||||
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
|
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
|
||||||
void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
BaseType_t MPU_xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffers,
|
BaseType_t MPU_xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffers,
|
||||||
uint8_t * ppucStreamBufferStorageArea,
|
uint8_t * ppucStreamBufferStorageArea,
|
||||||
StaticStreamBuffer_t * ppxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
|
StaticStreamBuffer_t * ppxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
@ -337,5 +487,6 @@ BaseType_t MPU_xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBu
|
||||||
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t MPU_xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
|
BaseType_t MPU_xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
|
||||||
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
BaseType_t MPU_xStreamBufferResetFromISR( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
#endif /* MPU_PROTOTYPES_H */
|
#endif /* MPU_PROTOTYPES_H */
|
||||||
|
|
105
include/mpu_syscall_numbers.h
Normal file
105
include/mpu_syscall_numbers.h
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://www.FreeRTOS.org
|
||||||
|
* https://github.com/FreeRTOS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MPU_SYSCALL_NUMBERS_H
|
||||||
|
#define MPU_SYSCALL_NUMBERS_H
|
||||||
|
|
||||||
|
/* Numbers assigned to various system calls. */
|
||||||
|
#define SYSTEM_CALL_xTaskGenericNotify 0
|
||||||
|
#define SYSTEM_CALL_xTaskGenericNotifyWait 1
|
||||||
|
#define SYSTEM_CALL_xTimerGenericCommandFromTask 2
|
||||||
|
#define SYSTEM_CALL_xEventGroupWaitBits 3
|
||||||
|
#define SYSTEM_CALL_xTaskDelayUntil 4
|
||||||
|
#define SYSTEM_CALL_xTaskAbortDelay 5
|
||||||
|
#define SYSTEM_CALL_vTaskDelay 6
|
||||||
|
#define SYSTEM_CALL_uxTaskPriorityGet 7
|
||||||
|
#define SYSTEM_CALL_eTaskGetState 8
|
||||||
|
#define SYSTEM_CALL_vTaskGetInfo 9
|
||||||
|
#define SYSTEM_CALL_xTaskGetIdleTaskHandle 10
|
||||||
|
#define SYSTEM_CALL_vTaskSuspend 11
|
||||||
|
#define SYSTEM_CALL_vTaskResume 12
|
||||||
|
#define SYSTEM_CALL_xTaskGetTickCount 13
|
||||||
|
#define SYSTEM_CALL_uxTaskGetNumberOfTasks 14
|
||||||
|
#define SYSTEM_CALL_ulTaskGetRunTimeCounter 15
|
||||||
|
#define SYSTEM_CALL_ulTaskGetRunTimePercent 16
|
||||||
|
#define SYSTEM_CALL_ulTaskGetIdleRunTimePercent 17
|
||||||
|
#define SYSTEM_CALL_ulTaskGetIdleRunTimeCounter 18
|
||||||
|
#define SYSTEM_CALL_vTaskSetApplicationTaskTag 19
|
||||||
|
#define SYSTEM_CALL_xTaskGetApplicationTaskTag 20
|
||||||
|
#define SYSTEM_CALL_vTaskSetThreadLocalStoragePointer 21
|
||||||
|
#define SYSTEM_CALL_pvTaskGetThreadLocalStoragePointer 22
|
||||||
|
#define SYSTEM_CALL_uxTaskGetSystemState 23
|
||||||
|
#define SYSTEM_CALL_uxTaskGetStackHighWaterMark 24
|
||||||
|
#define SYSTEM_CALL_uxTaskGetStackHighWaterMark2 25
|
||||||
|
#define SYSTEM_CALL_xTaskGetCurrentTaskHandle 26
|
||||||
|
#define SYSTEM_CALL_xTaskGetSchedulerState 27
|
||||||
|
#define SYSTEM_CALL_vTaskSetTimeOutState 28
|
||||||
|
#define SYSTEM_CALL_xTaskCheckForTimeOut 29
|
||||||
|
#define SYSTEM_CALL_ulTaskGenericNotifyTake 30
|
||||||
|
#define SYSTEM_CALL_xTaskGenericNotifyStateClear 31
|
||||||
|
#define SYSTEM_CALL_ulTaskGenericNotifyValueClear 32
|
||||||
|
#define SYSTEM_CALL_xQueueGenericSend 33
|
||||||
|
#define SYSTEM_CALL_uxQueueMessagesWaiting 34
|
||||||
|
#define SYSTEM_CALL_uxQueueSpacesAvailable 35
|
||||||
|
#define SYSTEM_CALL_xQueueReceive 36
|
||||||
|
#define SYSTEM_CALL_xQueuePeek 37
|
||||||
|
#define SYSTEM_CALL_xQueueSemaphoreTake 38
|
||||||
|
#define SYSTEM_CALL_xQueueGetMutexHolder 39
|
||||||
|
#define SYSTEM_CALL_xQueueTakeMutexRecursive 40
|
||||||
|
#define SYSTEM_CALL_xQueueGiveMutexRecursive 41
|
||||||
|
#define SYSTEM_CALL_xQueueSelectFromSet 42
|
||||||
|
#define SYSTEM_CALL_xQueueAddToSet 43
|
||||||
|
#define SYSTEM_CALL_vQueueAddToRegistry 44
|
||||||
|
#define SYSTEM_CALL_vQueueUnregisterQueue 45
|
||||||
|
#define SYSTEM_CALL_pcQueueGetName 46
|
||||||
|
#define SYSTEM_CALL_pvTimerGetTimerID 47
|
||||||
|
#define SYSTEM_CALL_vTimerSetTimerID 48
|
||||||
|
#define SYSTEM_CALL_xTimerIsTimerActive 49
|
||||||
|
#define SYSTEM_CALL_xTimerGetTimerDaemonTaskHandle 50
|
||||||
|
#define SYSTEM_CALL_pcTimerGetName 51
|
||||||
|
#define SYSTEM_CALL_vTimerSetReloadMode 52
|
||||||
|
#define SYSTEM_CALL_xTimerGetReloadMode 53
|
||||||
|
#define SYSTEM_CALL_uxTimerGetReloadMode 54
|
||||||
|
#define SYSTEM_CALL_xTimerGetPeriod 55
|
||||||
|
#define SYSTEM_CALL_xTimerGetExpiryTime 56
|
||||||
|
#define SYSTEM_CALL_xEventGroupClearBits 57
|
||||||
|
#define SYSTEM_CALL_xEventGroupSetBits 58
|
||||||
|
#define SYSTEM_CALL_xEventGroupSync 59
|
||||||
|
#define SYSTEM_CALL_uxEventGroupGetNumber 60
|
||||||
|
#define SYSTEM_CALL_vEventGroupSetNumber 61
|
||||||
|
#define SYSTEM_CALL_xStreamBufferSend 62
|
||||||
|
#define SYSTEM_CALL_xStreamBufferReceive 63
|
||||||
|
#define SYSTEM_CALL_xStreamBufferIsFull 64
|
||||||
|
#define SYSTEM_CALL_xStreamBufferIsEmpty 65
|
||||||
|
#define SYSTEM_CALL_xStreamBufferSpacesAvailable 66
|
||||||
|
#define SYSTEM_CALL_xStreamBufferBytesAvailable 67
|
||||||
|
#define SYSTEM_CALL_xStreamBufferSetTriggerLevel 68
|
||||||
|
#define SYSTEM_CALL_xStreamBufferNextMessageLengthBytes 69
|
||||||
|
#define NUM_SYSTEM_CALLS 70 /* Total number of system calls. */
|
||||||
|
|
||||||
|
#endif /* MPU_SYSCALL_NUMBERS_H */
|
|
@ -57,7 +57,6 @@
|
||||||
#define vTaskResume MPU_vTaskResume
|
#define vTaskResume MPU_vTaskResume
|
||||||
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
||||||
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
||||||
#define pcTaskGetName MPU_pcTaskGetName
|
|
||||||
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
||||||
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
|
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2
|
||||||
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
||||||
|
@ -86,6 +85,18 @@
|
||||||
/* Privileged only wrappers for Task APIs. These are needed so that
|
/* Privileged only wrappers for Task APIs. These are needed so that
|
||||||
* the application can use opaque handles maintained in mpu_wrappers.c
|
* the application can use opaque handles maintained in mpu_wrappers.c
|
||||||
* with all the APIs. */
|
* with all the APIs. */
|
||||||
|
#if ( configUSE_MPU_WRAPPERS_V1 == 1 )
|
||||||
|
|
||||||
|
/* These are not needed in v2 because they do not take a task
|
||||||
|
* handle and therefore, no lookup is needed. Needed in v1 because
|
||||||
|
* these are available as system calls in v1. */
|
||||||
|
#define vTaskGetRunTimeStatistics MPU_vTaskGetRunTimeStatistics
|
||||||
|
#define vTaskListTasks MPU_vTaskListTasks
|
||||||
|
#define vTaskSuspendAll MPU_vTaskSuspendAll
|
||||||
|
#define xTaskCatchUpTicks MPU_xTaskCatchUpTicks
|
||||||
|
#define xTaskResumeAll MPU_xTaskResumeAll
|
||||||
|
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 1 ) */
|
||||||
|
|
||||||
#define xTaskCreate MPU_xTaskCreate
|
#define xTaskCreate MPU_xTaskCreate
|
||||||
#define xTaskCreateStatic MPU_xTaskCreateStatic
|
#define xTaskCreateStatic MPU_xTaskCreateStatic
|
||||||
#define vTaskDelete MPU_vTaskDelete
|
#define vTaskDelete MPU_vTaskDelete
|
||||||
|
@ -94,11 +105,14 @@
|
||||||
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
||||||
|
|
||||||
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
||||||
|
#define pcTaskGetName MPU_pcTaskGetName
|
||||||
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
|
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
|
||||||
#define xTaskCreateRestrictedStatic MPU_xTaskCreateRestrictedStatic
|
#define xTaskCreateRestrictedStatic MPU_xTaskCreateRestrictedStatic
|
||||||
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
||||||
#define xTaskGetStaticBuffers MPU_xTaskGetStaticBuffers
|
#define xTaskGetStaticBuffers MPU_xTaskGetStaticBuffers
|
||||||
#define uxTaskPriorityGetFromISR MPU_uxTaskPriorityGetFromISR
|
#define uxTaskPriorityGetFromISR MPU_uxTaskPriorityGetFromISR
|
||||||
|
#define uxTaskBasePriorityGet MPU_uxTaskBasePriorityGet
|
||||||
|
#define uxTaskBasePriorityGetFromISR MPU_uxTaskBasePriorityGetFromISR
|
||||||
#define xTaskResumeFromISR MPU_xTaskResumeFromISR
|
#define xTaskResumeFromISR MPU_xTaskResumeFromISR
|
||||||
#define xTaskGetApplicationTaskTagFromISR MPU_xTaskGetApplicationTaskTagFromISR
|
#define xTaskGetApplicationTaskTagFromISR MPU_xTaskGetApplicationTaskTagFromISR
|
||||||
#define xTaskGenericNotifyFromISR MPU_xTaskGenericNotifyFromISR
|
#define xTaskGenericNotifyFromISR MPU_xTaskGenericNotifyFromISR
|
||||||
|
@ -136,6 +150,7 @@
|
||||||
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
|
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
|
||||||
#define xQueueGenericReset MPU_xQueueGenericReset
|
#define xQueueGenericReset MPU_xQueueGenericReset
|
||||||
#define xQueueCreateSet MPU_xQueueCreateSet
|
#define xQueueCreateSet MPU_xQueueCreateSet
|
||||||
|
#define xQueueCreateSetStatic MPU_xQueueCreateSetStatic
|
||||||
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
||||||
|
|
||||||
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
||||||
|
@ -156,21 +171,25 @@
|
||||||
#define vTimerSetTimerID MPU_vTimerSetTimerID
|
#define vTimerSetTimerID MPU_vTimerSetTimerID
|
||||||
#define xTimerIsTimerActive MPU_xTimerIsTimerActive
|
#define xTimerIsTimerActive MPU_xTimerIsTimerActive
|
||||||
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
|
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
|
||||||
#define xTimerGenericCommand MPU_xTimerGenericCommand
|
#define xTimerGenericCommandFromTask MPU_xTimerGenericCommandFromTask
|
||||||
#define pcTimerGetName MPU_pcTimerGetName
|
#define pcTimerGetName MPU_pcTimerGetName
|
||||||
#define vTimerSetReloadMode MPU_vTimerSetReloadMode
|
#define vTimerSetReloadMode MPU_vTimerSetReloadMode
|
||||||
#define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
|
#define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
|
||||||
#define xTimerGetPeriod MPU_xTimerGetPeriod
|
#define xTimerGetPeriod MPU_xTimerGetPeriod
|
||||||
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
|
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
|
||||||
|
|
||||||
|
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
||||||
|
#define xTimerGetReloadMode MPU_xTimerGetReloadMode
|
||||||
|
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
|
||||||
|
|
||||||
/* Privileged only wrappers for Timer APIs. These are needed so that
|
/* Privileged only wrappers for Timer APIs. These are needed so that
|
||||||
* the application can use opaque handles maintained in mpu_wrappers.c
|
* the application can use opaque handles maintained in mpu_wrappers.c
|
||||||
* with all the APIs. */
|
* with all the APIs. */
|
||||||
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
||||||
#define xTimerGetReloadMode MPU_xTimerGetReloadMode
|
|
||||||
#define xTimerCreate MPU_xTimerCreate
|
#define xTimerCreate MPU_xTimerCreate
|
||||||
#define xTimerCreateStatic MPU_xTimerCreateStatic
|
#define xTimerCreateStatic MPU_xTimerCreateStatic
|
||||||
#define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer
|
#define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer
|
||||||
|
#define xTimerGenericCommandFromISR MPU_xTimerGenericCommandFromISR
|
||||||
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
|
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
|
||||||
|
|
||||||
/* Map standard event_group.h API functions to the MPU equivalents. */
|
/* Map standard event_group.h API functions to the MPU equivalents. */
|
||||||
|
@ -224,24 +243,43 @@
|
||||||
#define xStreamBufferReceiveFromISR MPU_xStreamBufferReceiveFromISR
|
#define xStreamBufferReceiveFromISR MPU_xStreamBufferReceiveFromISR
|
||||||
#define xStreamBufferSendCompletedFromISR MPU_xStreamBufferSendCompletedFromISR
|
#define xStreamBufferSendCompletedFromISR MPU_xStreamBufferSendCompletedFromISR
|
||||||
#define xStreamBufferReceiveCompletedFromISR MPU_xStreamBufferReceiveCompletedFromISR
|
#define xStreamBufferReceiveCompletedFromISR MPU_xStreamBufferReceiveCompletedFromISR
|
||||||
|
#define xStreamBufferResetFromISR MPU_xStreamBufferResetFromISR
|
||||||
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
|
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */
|
||||||
|
|
||||||
/* Remove the privileged function macro, but keep the PRIVILEGED_DATA
|
#if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) )
|
||||||
* macro so applications can place data in privileged access sections
|
|
||||||
* (useful when using statically allocated objects). */
|
|
||||||
#define PRIVILEGED_FUNCTION
|
|
||||||
#define PRIVILEGED_DATA __attribute__( ( section( "privileged_data" ) ) )
|
|
||||||
#define FREERTOS_SYSTEM_CALL
|
|
||||||
|
|
||||||
#else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
#define vGrantAccessToTask( xTask, xTaskToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xTaskToGrantAccess ) )
|
||||||
|
#define vRevokeAccessToTask( xTask, xTaskToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xTaskToRevokeAccess ) )
|
||||||
|
|
||||||
|
#define vGrantAccessToSemaphore( xTask, xSemaphoreToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xSemaphoreToGrantAccess ) )
|
||||||
|
#define vRevokeAccessToSemaphore( xTask, xSemaphoreToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xSemaphoreToRevokeAccess ) )
|
||||||
|
|
||||||
|
#define vGrantAccessToQueue( xTask, xQueueToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xQueueToGrantAccess ) )
|
||||||
|
#define vRevokeAccessToQueue( xTask, xQueueToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xQueueToRevokeAccess ) )
|
||||||
|
|
||||||
|
#define vGrantAccessToQueueSet( xTask, xQueueSetToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xQueueSetToGrantAccess ) )
|
||||||
|
#define vRevokeAccessToQueueSet( xTask, xQueueSetToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xQueueSetToRevokeAccess ) )
|
||||||
|
|
||||||
|
#define vGrantAccessToEventGroup( xTask, xEventGroupToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xEventGroupToGrantAccess ) )
|
||||||
|
#define vRevokeAccessToEventGroup( xTask, xEventGroupToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xEventGroupToRevokeAccess ) )
|
||||||
|
|
||||||
|
#define vGrantAccessToStreamBuffer( xTask, xStreamBufferToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xStreamBufferToGrantAccess ) )
|
||||||
|
#define vRevokeAccessToStreamBuffer( xTask, xStreamBufferToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xStreamBufferToRevokeAccess ) )
|
||||||
|
|
||||||
|
#define vGrantAccessToMessageBuffer( xTask, xMessageBufferToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xMessageBufferToGrantAccess ) )
|
||||||
|
#define vRevokeAccessToMessageBuffer( xTask, xMessageBufferToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xMessageBufferToRevokeAccess ) )
|
||||||
|
|
||||||
|
#define vGrantAccessToTimer( xTask, xTimerToGrantAccess ) vGrantAccessToKernelObject( ( xTask ), ( int32_t ) ( xTimerToGrantAccess ) )
|
||||||
|
#define vRevokeAccessToTimer( xTask, xTimerToRevokeAccess ) vRevokeAccessToKernelObject( ( xTask ), ( int32_t ) ( xTimerToRevokeAccess ) )
|
||||||
|
|
||||||
|
#endif /* #if ( ( configUSE_MPU_WRAPPERS_V1 == 0 ) && ( configENABLE_ACCESS_CONTROL_LIST == 1 ) ) */
|
||||||
|
|
||||||
|
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||||
|
|
||||||
/* Ensure API functions go in the privileged execution section. */
|
|
||||||
#define PRIVILEGED_FUNCTION __attribute__( ( section( "privileged_functions" ) ) )
|
#define PRIVILEGED_FUNCTION __attribute__( ( section( "privileged_functions" ) ) )
|
||||||
#define PRIVILEGED_DATA __attribute__( ( section( "privileged_data" ) ) )
|
#define PRIVILEGED_DATA __attribute__( ( section( "privileged_data" ) ) )
|
||||||
#define FREERTOS_SYSTEM_CALL __attribute__( ( section( "freertos_system_calls" ) ) )
|
#define FREERTOS_SYSTEM_CALL __attribute__( ( section( "freertos_system_calls" ) ) )
|
||||||
|
|
||||||
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
|
||||||
|
|
||||||
#else /* portUSING_MPU_WRAPPERS */
|
#else /* portUSING_MPU_WRAPPERS */
|
||||||
|
|
||||||
#define PRIVILEGED_FUNCTION
|
#define PRIVILEGED_FUNCTION
|
||||||
|
|
|
@ -58,17 +58,18 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allocate thread local storage block off the end of the
|
/* Allocate thread local storage block off the end of the
|
||||||
* stack. The _tls_size() function returns the size (in
|
* stack. The picolibcTLS_SIZE macro returns the size (in
|
||||||
* bytes) of the total TLS area used by the application */
|
* bytes) of the total TLS area used by the application.
|
||||||
|
* Calculate the top of stack address. */
|
||||||
#if ( portSTACK_GROWTH < 0 )
|
#if ( portSTACK_GROWTH < 0 )
|
||||||
|
|
||||||
#define configINIT_TLS_BLOCK( xTLSBlock, pxTopOfStack ) \
|
#define configINIT_TLS_BLOCK( xTLSBlock, pxTopOfStack ) \
|
||||||
do { \
|
do { \
|
||||||
pxTopOfStack = ( StackType_t * ) ( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) \
|
xTLSBlock = ( void * ) ( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) - \
|
||||||
- picolibcTLS_SIZE ) & ~ \
|
picolibcTLS_SIZE ) & \
|
||||||
configMAX( picolibcSTACK_ALIGNMENT_MASK, \
|
~picolibcTLS_ALIGNMENT_MASK ); \
|
||||||
picolibcTLS_ALIGNMENT_MASK ) ); \
|
pxTopOfStack = ( StackType_t * ) ( ( ( ( portPOINTER_SIZE_TYPE ) xTLSBlock ) - 1 ) & \
|
||||||
xTLSBlock = pxTopOfStack; \
|
~picolibcSTACK_ALIGNMENT_MASK ); \
|
||||||
_init_tls( xTLSBlock ); \
|
_init_tls( xTLSBlock ); \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
#else /* portSTACK_GROWTH */
|
#else /* portSTACK_GROWTH */
|
||||||
|
|
|
@ -85,19 +85,31 @@
|
||||||
#define portARCH_NAME NULL
|
#define portARCH_NAME NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef portBASE_TYPE_ENTER_CRITICAL
|
||||||
|
#define portBASE_TYPE_ENTER_CRITICAL() taskENTER_CRITICAL()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portBASE_TYPE_EXIT_CRITICAL
|
||||||
|
#define portBASE_TYPE_EXIT_CRITICAL() taskEXIT_CRITICAL()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configSTACK_DEPTH_TYPE
|
||||||
|
#define configSTACK_DEPTH_TYPE StackType_t
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
|
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
|
||||||
/* Defaults to 0 for backward compatibility. */
|
/* Defaults to 0 for backward compatibility. */
|
||||||
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "mpu_wrappers.h"
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
#include "mpu_wrappers.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup the stack of a new task so it is ready to be placed under the
|
* Setup the stack of a new task so it is ready to be placed under the
|
||||||
* scheduler control. The registers have to be placed on the stack in
|
* scheduler control. The registers have to be placed on the stack in
|
||||||
|
@ -174,13 +186,14 @@ void vPortGetHeapStats( HeapStats_t * pxHeapStats );
|
||||||
/*
|
/*
|
||||||
* Map to the memory management routines required for the port.
|
* Map to the memory management routines required for the port.
|
||||||
*/
|
*/
|
||||||
void * pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
|
void * pvPortMalloc( size_t xWantedSize ) PRIVILEGED_FUNCTION;
|
||||||
void * pvPortCalloc( size_t xNum,
|
void * pvPortCalloc( size_t xNum,
|
||||||
size_t xSize ) PRIVILEGED_FUNCTION;
|
size_t xSize ) PRIVILEGED_FUNCTION;
|
||||||
void vPortFree( void * pv ) PRIVILEGED_FUNCTION;
|
void vPortFree( void * pv ) PRIVILEGED_FUNCTION;
|
||||||
void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
|
void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
|
||||||
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||||
size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||||
|
void xPortResetHeapMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
#if ( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 )
|
#if ( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 )
|
||||||
void * pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION;
|
void * pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION;
|
||||||
|
@ -190,6 +203,12 @@ size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||||
#define vPortFreeStack vPortFree
|
#define vPortFreeStack vPortFree
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function resets the internal state of the heap module. It must be called
|
||||||
|
* by the application before restarting the scheduler.
|
||||||
|
*/
|
||||||
|
void vPortHeapResetState( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
#if ( configUSE_MALLOC_FAILED_HOOK == 1 )
|
#if ( configUSE_MALLOC_FAILED_HOOK == 1 )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,7 +219,7 @@ size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||||
*
|
*
|
||||||
* This hook function is called when allocation failed.
|
* This hook function is called when allocation failed.
|
||||||
*/
|
*/
|
||||||
void vApplicationMallocFailedHook( void ); /*lint !e526 Symbol not defined as it is an application callback. */
|
void vApplicationMallocFailedHook( void );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -228,7 +247,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
||||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
|
||||||
const struct xMEMORY_REGION * const xRegions,
|
const struct xMEMORY_REGION * const xRegions,
|
||||||
StackType_t * pxBottomOfStack,
|
StackType_t * pxBottomOfStack,
|
||||||
uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
|
configSTACK_DEPTH_TYPE uxStackDepth ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -247,6 +266,21 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
||||||
uint32_t ulAccessRequested ) PRIVILEGED_FUNCTION;
|
uint32_t ulAccessRequested ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if the calling task is authorized to access the given kernel object.
|
||||||
|
*
|
||||||
|
* @param lInternalIndexOfKernelObject The index of the kernel object in the kernel
|
||||||
|
* object handle pool.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the calling task is authorized to access the kernel object,
|
||||||
|
* pdFALSE otherwise.
|
||||||
|
*/
|
||||||
|
#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
||||||
|
|
||||||
|
BaseType_t xPortIsAuthorizedToAccessKernelObject( int32_t lInternalIndexOfKernelObject ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,20 @@
|
||||||
* Defines the prototype to which task functions must conform. Defined in this
|
* Defines the prototype to which task functions must conform. Defined in this
|
||||||
* file to ensure the type is known before portable.h is included.
|
* file to ensure the type is known before portable.h is included.
|
||||||
*/
|
*/
|
||||||
typedef void (* TaskFunction_t)( void * );
|
typedef void (* TaskFunction_t)( void * arg );
|
||||||
|
|
||||||
/* Converts a time in milliseconds to a time in ticks. This macro can be
|
/* Converts a time in milliseconds to a time in ticks. This macro can be
|
||||||
* overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
|
* overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
|
||||||
* definition here is not suitable for your application. */
|
* definition here is not suitable for your application. */
|
||||||
#ifndef pdMS_TO_TICKS
|
#ifndef pdMS_TO_TICKS
|
||||||
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000U ) )
|
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( uint64_t ) ( xTimeInMs ) * ( uint64_t ) configTICK_RATE_HZ ) / ( uint64_t ) 1000U ) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Converts a time in ticks to a time in milliseconds. This macro can be
|
||||||
|
* overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
|
||||||
|
* definition here is not suitable for your application. */
|
||||||
|
#ifndef pdTICKS_TO_MS
|
||||||
|
#define pdTICKS_TO_MS( xTimeInTicks ) ( ( TickType_t ) ( ( ( uint64_t ) ( xTimeInTicks ) * ( uint64_t ) 1000U ) / ( uint64_t ) configTICK_RATE_HZ ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define pdFALSE ( ( BaseType_t ) 0 )
|
#define pdFALSE ( ( BaseType_t ) 0 )
|
||||||
|
|
201
include/queue.h
201
include/queue.h
|
@ -34,14 +34,14 @@
|
||||||
#error "include FreeRTOS.h" must appear in source files before "include queue.h"
|
#error "include FreeRTOS.h" must appear in source files before "include queue.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
#include "task.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type by which queues are referenced. For example, a call to xQueueCreate()
|
* Type by which queues are referenced. For example, a call to xQueueCreate()
|
||||||
* returns an QueueHandle_t variable that can then be used as a parameter to
|
* returns an QueueHandle_t variable that can then be used as a parameter to
|
||||||
|
@ -71,11 +71,11 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
|
|
||||||
/* For internal use only. These definitions *must* match those in queue.c. */
|
/* For internal use only. These definitions *must* match those in queue.c. */
|
||||||
#define queueQUEUE_TYPE_BASE ( ( uint8_t ) 0U )
|
#define queueQUEUE_TYPE_BASE ( ( uint8_t ) 0U )
|
||||||
#define queueQUEUE_TYPE_SET ( ( uint8_t ) 0U )
|
|
||||||
#define queueQUEUE_TYPE_MUTEX ( ( uint8_t ) 1U )
|
#define queueQUEUE_TYPE_MUTEX ( ( uint8_t ) 1U )
|
||||||
#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( uint8_t ) 2U )
|
#define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( uint8_t ) 2U )
|
||||||
#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( uint8_t ) 3U )
|
#define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( uint8_t ) 3U )
|
||||||
#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( uint8_t ) 4U )
|
#define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( uint8_t ) 4U )
|
||||||
|
#define queueQUEUE_TYPE_SET ( ( uint8_t ) 5U )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -109,7 +109,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* the same size.
|
* the same size.
|
||||||
*
|
*
|
||||||
* @return If the queue is successfully create then a handle to the newly
|
* @return If the queue is successfully create then a handle to the newly
|
||||||
* created queue is returned. If the queue cannot be created then 0 is
|
* created queue is returned. If the queue cannot be created then NULL is
|
||||||
* returned.
|
* returned.
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
|
@ -126,7 +126,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
*
|
*
|
||||||
* // Create a queue capable of containing 10 uint32_t values.
|
* // Create a queue capable of containing 10 uint32_t values.
|
||||||
* xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
|
* xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
|
||||||
* if( xQueue1 == 0 )
|
* if( xQueue1 == NULL )
|
||||||
* {
|
* {
|
||||||
* // Queue was not created and must not be used.
|
* // Queue was not created and must not be used.
|
||||||
* }
|
* }
|
||||||
|
@ -134,7 +134,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* // Create a queue capable of containing 10 pointers to AMessage structures.
|
* // Create a queue capable of containing 10 pointers to AMessage structures.
|
||||||
* // These should be passed by pointer as they contain a lot of data.
|
* // These should be passed by pointer as they contain a lot of data.
|
||||||
* xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
|
* xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
|
||||||
* if( xQueue2 == 0 )
|
* if( xQueue2 == NULL )
|
||||||
* {
|
* {
|
||||||
* // Queue was not created and must not be used.
|
* // Queue was not created and must not be used.
|
||||||
* }
|
* }
|
||||||
|
@ -267,7 +267,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
* @code{c}
|
* @code{c}
|
||||||
* BaseType_t xQueueSendToToFront(
|
* BaseType_t xQueueSendToFront(
|
||||||
* QueueHandle_t xQueue,
|
* QueueHandle_t xQueue,
|
||||||
* const void *pvItemToQueue,
|
* const void *pvItemToQueue,
|
||||||
* TickType_t xTicksToWait
|
* TickType_t xTicksToWait
|
||||||
|
@ -292,7 +292,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* queue is full. The time is defined in tick periods so the constant
|
* queue is full. The time is defined in tick periods so the constant
|
||||||
* portTICK_PERIOD_MS should be used to convert to real time if this is required.
|
* portTICK_PERIOD_MS should be used to convert to real time if this is required.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
|
* @return pdPASS if the item was successfully posted, otherwise errQUEUE_FULL.
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -302,7 +302,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* char ucData[ 20 ];
|
* char ucData[ 20 ];
|
||||||
* } xMessage;
|
* } xMessage;
|
||||||
*
|
*
|
||||||
* uint32_t ulVar = 10UL;
|
* uint32_t ulVar = 10U;
|
||||||
*
|
*
|
||||||
* void vATask( void *pvParameters )
|
* void vATask( void *pvParameters )
|
||||||
* {
|
* {
|
||||||
|
@ -375,7 +375,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* is full. The time is defined in tick periods so the constant
|
* is full. The time is defined in tick periods so the constant
|
||||||
* portTICK_PERIOD_MS should be used to convert to real time if this is required.
|
* portTICK_PERIOD_MS should be used to convert to real time if this is required.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
|
* @return pdPASS if the item was successfully posted, otherwise errQUEUE_FULL.
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -385,7 +385,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* char ucData[ 20 ];
|
* char ucData[ 20 ];
|
||||||
* } xMessage;
|
* } xMessage;
|
||||||
*
|
*
|
||||||
* uint32_t ulVar = 10UL;
|
* uint32_t ulVar = 10U;
|
||||||
*
|
*
|
||||||
* void vATask( void *pvParameters )
|
* void vATask( void *pvParameters )
|
||||||
* {
|
* {
|
||||||
|
@ -460,7 +460,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* queue is full. The time is defined in tick periods so the constant
|
* queue is full. The time is defined in tick periods so the constant
|
||||||
* portTICK_PERIOD_MS should be used to convert to real time if this is required.
|
* portTICK_PERIOD_MS should be used to convert to real time if this is required.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
|
* @return pdPASS if the item was successfully posted, otherwise errQUEUE_FULL.
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -470,7 +470,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* char ucData[ 20 ];
|
* char ucData[ 20 ];
|
||||||
* } xMessage;
|
* } xMessage;
|
||||||
*
|
*
|
||||||
* uint32_t ulVar = 10UL;
|
* uint32_t ulVar = 10U;
|
||||||
*
|
*
|
||||||
* void vATask( void *pvParameters )
|
* void vATask( void *pvParameters )
|
||||||
* {
|
* {
|
||||||
|
@ -633,7 +633,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* item at the back of the queue, or queueSEND_TO_FRONT to place the item
|
* item at the back of the queue, or queueSEND_TO_FRONT to place the item
|
||||||
* at the front of the queue (for high priority messages).
|
* at the front of the queue (for high priority messages).
|
||||||
*
|
*
|
||||||
* @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
|
* @return pdPASS if the item was successfully posted, otherwise errQUEUE_FULL.
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -643,7 +643,7 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
|
||||||
* char ucData[ 20 ];
|
* char ucData[ 20 ];
|
||||||
* } xMessage;
|
* } xMessage;
|
||||||
*
|
*
|
||||||
* uint32_t ulVar = 10UL;
|
* uint32_t ulVar = 10U;
|
||||||
*
|
*
|
||||||
* void vATask( void *pvParameters )
|
* void vATask( void *pvParameters )
|
||||||
* {
|
* {
|
||||||
|
@ -723,8 +723,8 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
|
||||||
* xQueuePeek() will return immediately if xTicksToWait is 0 and the queue
|
* xQueuePeek() will return immediately if xTicksToWait is 0 and the queue
|
||||||
* is empty.
|
* is empty.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if an item was successfully received from the queue,
|
* @return pdPASS if an item was successfully received from the queue,
|
||||||
* otherwise pdFALSE.
|
* otherwise errQUEUE_EMPTY.
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -811,8 +811,8 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
|
||||||
* @param pvBuffer Pointer to the buffer into which the received item will
|
* @param pvBuffer Pointer to the buffer into which the received item will
|
||||||
* be copied.
|
* be copied.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if an item was successfully received from the queue,
|
* @return pdPASS if an item was successfully received from the queue,
|
||||||
* otherwise pdFALSE.
|
* otherwise pdFAIL.
|
||||||
*
|
*
|
||||||
* \defgroup xQueuePeekFromISR xQueuePeekFromISR
|
* \defgroup xQueuePeekFromISR xQueuePeekFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
|
@ -852,8 +852,8 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
|
||||||
* constant portTICK_PERIOD_MS should be used to convert to real time if this is
|
* constant portTICK_PERIOD_MS should be used to convert to real time if this is
|
||||||
* required.
|
* required.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if an item was successfully received from the queue,
|
* @return pdPASS if an item was successfully received from the queue,
|
||||||
* otherwise pdFALSE.
|
* otherwise errQUEUE_EMPTY.
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -995,10 +995,10 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
* @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set
|
* @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set
|
||||||
* *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
|
* *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
|
||||||
* to unblock, and the unblocked task has a priority higher than the currently
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
* running task. If xQueueSendToFromFromISR() sets this value to pdTRUE then
|
* running task. If xQueueSendToFrontFromISR() sets this value to pdTRUE then
|
||||||
* a context switch should be requested before the interrupt is exited.
|
* a context switch should be requested before the interrupt is exited.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if the data was successfully sent to the queue, otherwise
|
* @return pdPASS if the data was successfully sent to the queue, otherwise
|
||||||
* errQUEUE_FULL.
|
* errQUEUE_FULL.
|
||||||
*
|
*
|
||||||
* Example usage for buffered IO (where the ISR can obtain more than one value
|
* Example usage for buffered IO (where the ISR can obtain more than one value
|
||||||
|
@ -1070,7 +1070,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
* running task. If xQueueSendToBackFromISR() sets this value to pdTRUE then
|
* running task. If xQueueSendToBackFromISR() sets this value to pdTRUE then
|
||||||
* a context switch should be requested before the interrupt is exited.
|
* a context switch should be requested before the interrupt is exited.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if the data was successfully sent to the queue, otherwise
|
* @return pdPASS if the data was successfully sent to the queue, otherwise
|
||||||
* errQUEUE_FULL.
|
* errQUEUE_FULL.
|
||||||
*
|
*
|
||||||
* Example usage for buffered IO (where the ISR can obtain more than one value
|
* Example usage for buffered IO (where the ISR can obtain more than one value
|
||||||
|
@ -1187,7 +1187,10 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
* // has a priority higher than or equal to the priority of the currently
|
* // has a priority higher than or equal to the priority of the currently
|
||||||
* // executing task (the task this interrupt interrupted). Perform a context
|
* // executing task (the task this interrupt interrupted). Perform a context
|
||||||
* // switch so this interrupt returns directly to the unblocked task.
|
* // switch so this interrupt returns directly to the unblocked task.
|
||||||
* portYIELD_FROM_ISR(); // or portEND_SWITCHING_ISR() depending on the port.
|
* // The macro used is port specific and will be either
|
||||||
|
* // portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() - refer to the documentation
|
||||||
|
* // page for the port being used.
|
||||||
|
* portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
|
@ -1232,7 +1235,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
* running task. If xQueueSendFromISR() sets this value to pdTRUE then
|
* running task. If xQueueSendFromISR() sets this value to pdTRUE then
|
||||||
* a context switch should be requested before the interrupt is exited.
|
* a context switch should be requested before the interrupt is exited.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if the data was successfully sent to the queue, otherwise
|
* @return pdPASS if the data was successfully sent to the queue, otherwise
|
||||||
* errQUEUE_FULL.
|
* errQUEUE_FULL.
|
||||||
*
|
*
|
||||||
* Example usage for buffered IO (where the ISR can obtain more than one value
|
* Example usage for buffered IO (where the ISR can obtain more than one value
|
||||||
|
@ -1260,8 +1263,11 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
* // Now the buffer is empty we can switch context if necessary.
|
* // Now the buffer is empty we can switch context if necessary.
|
||||||
* if( xHigherPriorityTaskWoken )
|
* if( xHigherPriorityTaskWoken )
|
||||||
* {
|
* {
|
||||||
* // Actual macro used here is port specific.
|
* // As xHigherPriorityTaskWoken is now set to pdTRUE then a context
|
||||||
* portYIELD_FROM_ISR ();
|
* // switch should be requested. The macro used is port specific and
|
||||||
|
* // will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
|
||||||
|
* // refer to the documentation page for the port being used.
|
||||||
|
* portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
|
@ -1312,7 +1318,7 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
* item at the back of the queue, or queueSEND_TO_FRONT to place the item
|
* item at the back of the queue, or queueSEND_TO_FRONT to place the item
|
||||||
* at the front of the queue (for high priority messages).
|
* at the front of the queue (for high priority messages).
|
||||||
*
|
*
|
||||||
* @return pdTRUE if the data was successfully sent to the queue, otherwise
|
* @return pdPASS if the data was successfully sent to the queue, otherwise
|
||||||
* errQUEUE_FULL.
|
* errQUEUE_FULL.
|
||||||
*
|
*
|
||||||
* Example usage for buffered IO (where the ISR can obtain more than one value
|
* Example usage for buffered IO (where the ISR can obtain more than one value
|
||||||
|
@ -1337,11 +1343,14 @@ void vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
*
|
*
|
||||||
* } while( portINPUT_BYTE( BUFFER_COUNT ) );
|
* } while( portINPUT_BYTE( BUFFER_COUNT ) );
|
||||||
*
|
*
|
||||||
* // Now the buffer is empty we can switch context if necessary. Note that the
|
* // Now the buffer is empty we can switch context if necessary.
|
||||||
* // name of the yield function required is port specific.
|
|
||||||
* if( xHigherPriorityTaskWokenByPost )
|
* if( xHigherPriorityTaskWokenByPost )
|
||||||
* {
|
* {
|
||||||
* portYIELD_FROM_ISR();
|
* // As xHigherPriorityTaskWokenByPost is now set to pdTRUE then a context
|
||||||
|
* // switch should be requested. The macro used is port specific and
|
||||||
|
* // will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
|
||||||
|
* // refer to the documentation page for the port being used.
|
||||||
|
* portYIELD_FROM_ISR( xHigherPriorityTaskWokenByPost );
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
|
@ -1380,8 +1389,8 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
|
||||||
* to unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will
|
* to unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will
|
||||||
* remain unchanged.
|
* remain unchanged.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if an item was successfully received from the queue,
|
* @return pdPASS if an item was successfully received from the queue,
|
||||||
* otherwise pdFALSE.
|
* otherwise pdFAIL.
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* @code{c}
|
* @code{c}
|
||||||
|
@ -1455,6 +1464,8 @@ BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FU
|
||||||
BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#if ( configUSE_CO_ROUTINES == 1 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The functions defined above are for passing data to and from tasks. The
|
* The functions defined above are for passing data to and from tasks. The
|
||||||
* functions below are the equivalents for passing data to and from
|
* functions below are the equivalents for passing data to and from
|
||||||
|
@ -1477,27 +1488,42 @@ BaseType_t xQueueCRReceive( QueueHandle_t xQueue,
|
||||||
void * pvBuffer,
|
void * pvBuffer,
|
||||||
TickType_t xTicksToWait );
|
TickType_t xTicksToWait );
|
||||||
|
|
||||||
|
#endif /* if ( configUSE_CO_ROUTINES == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For internal use only. Use xSemaphoreCreateMutex(),
|
* For internal use only. Use xSemaphoreCreateMutex(),
|
||||||
* xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling
|
* xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling
|
||||||
* these functions directly.
|
* these functions directly.
|
||||||
*/
|
*/
|
||||||
QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||||
QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType,
|
QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType,
|
||||||
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
|
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( configUSE_COUNTING_SEMAPHORES == 1 )
|
||||||
QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount,
|
QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount,
|
||||||
const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;
|
const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
|
||||||
QueueHandle_t xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
|
QueueHandle_t xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
|
||||||
const UBaseType_t uxInitialCount,
|
const UBaseType_t uxInitialCount,
|
||||||
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
|
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
|
||||||
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
|
||||||
TaskHandle_t xQueueGetMutexHolder( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
|
TaskHandle_t xQueueGetMutexHolder( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
|
||||||
TaskHandle_t xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
|
TaskHandle_t xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For internal use only. Use xSemaphoreTakeMutexRecursive() or
|
* For internal use only. Use xSemaphoreTakeRecursive() or
|
||||||
* xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
|
* xSemaphoreGiveRecursive() instead of calling these functions directly.
|
||||||
*/
|
*/
|
||||||
BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex,
|
BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex,
|
||||||
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
@ -1537,7 +1563,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
|
||||||
*/
|
*/
|
||||||
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
||||||
void vQueueAddToRegistry( QueueHandle_t xQueue,
|
void vQueueAddToRegistry( QueueHandle_t xQueue,
|
||||||
const char * pcQueueName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
const char * pcQueueName ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1566,7 +1592,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
|
||||||
* returned.
|
* returned.
|
||||||
*/
|
*/
|
||||||
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
||||||
const char * pcQueueGetName( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
const char * pcQueueGetName( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1612,14 +1638,14 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
|
||||||
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
|
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
|
||||||
* function.
|
* function.
|
||||||
*
|
*
|
||||||
* A queue set must be explicitly created using a call to xQueueCreateSet()
|
* A queue set must be explicitly created using a call to xQueueCreateSet() or
|
||||||
* before it can be used. Once created, standard FreeRTOS queues and semaphores
|
* xQueueCreateSetStatic() before it can be used. Once created, standard
|
||||||
* can be added to the set using calls to xQueueAddToSet().
|
* FreeRTOS queues and semaphores can be added to the set using calls to
|
||||||
* xQueueSelectFromSet() is then used to determine which, if any, of the queues
|
* xQueueAddToSet(). xQueueSelectFromSet() is then used to determine which, if
|
||||||
* or semaphores contained in the set is in a state where a queue read or
|
* any, of the queues or semaphores contained in the set is in a state where a
|
||||||
* semaphore take operation would be successful.
|
* queue read or semaphore take operation would be successful.
|
||||||
*
|
*
|
||||||
* Note 1: See the documentation on https://www.FreeRTOS.org/RTOS-queue-sets.html
|
* Note 1: See the documentation on https://www.freertos.org/Documentation/02-Kernel/04-API-references/07-Queue-sets/00-RTOS-queue-sets
|
||||||
* for reasons why queue sets are very rarely needed in practice as there are
|
* for reasons why queue sets are very rarely needed in practice as there are
|
||||||
* simpler methods of blocking on multiple objects.
|
* simpler methods of blocking on multiple objects.
|
||||||
*
|
*
|
||||||
|
@ -1653,11 +1679,73 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
|
||||||
* @return If the queue set is created successfully then a handle to the created
|
* @return If the queue set is created successfully then a handle to the created
|
||||||
* queue set is returned. Otherwise NULL is returned.
|
* queue set is returned. Otherwise NULL is returned.
|
||||||
*/
|
*/
|
||||||
|
#if ( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||||
QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
|
QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Queue sets provide a mechanism to allow a task to block (pend) on a read
|
||||||
|
* operation from multiple queues or semaphores simultaneously.
|
||||||
|
*
|
||||||
|
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
|
||||||
|
* function.
|
||||||
|
*
|
||||||
|
* A queue set must be explicitly created using a call to xQueueCreateSet()
|
||||||
|
* or xQueueCreateSetStatic() before it can be used. Once created, standard
|
||||||
|
* FreeRTOS queues and semaphores can be added to the set using calls to
|
||||||
|
* xQueueAddToSet(). xQueueSelectFromSet() is then used to determine which, if
|
||||||
|
* any, of the queues or semaphores contained in the set is in a state where a
|
||||||
|
* queue read or semaphore take operation would be successful.
|
||||||
|
*
|
||||||
|
* Note 1: See the documentation on https://www.freertos.org/Documentation/02-Kernel/04-API-references/07-Queue-sets/00-RTOS-queue-sets
|
||||||
|
* for reasons why queue sets are very rarely needed in practice as there are
|
||||||
|
* simpler methods of blocking on multiple objects.
|
||||||
|
*
|
||||||
|
* Note 2: Blocking on a queue set that contains a mutex will not cause the
|
||||||
|
* mutex holder to inherit the priority of the blocked task.
|
||||||
|
*
|
||||||
|
* Note 3: An additional 4 bytes of RAM is required for each space in a every
|
||||||
|
* queue added to a queue set. Therefore counting semaphores that have a high
|
||||||
|
* maximum count value should not be added to a queue set.
|
||||||
|
*
|
||||||
|
* Note 4: A receive (in the case of a queue) or take (in the case of a
|
||||||
|
* semaphore) operation must not be performed on a member of a queue set unless
|
||||||
|
* a call to xQueueSelectFromSet() has first returned a handle to that set member.
|
||||||
|
*
|
||||||
|
* @param uxEventQueueLength Queue sets store events that occur on
|
||||||
|
* the queues and semaphores contained in the set. uxEventQueueLength specifies
|
||||||
|
* the maximum number of events that can be queued at once. To be absolutely
|
||||||
|
* certain that events are not lost uxEventQueueLength should be set to the
|
||||||
|
* total sum of the length of the queues added to the set, where binary
|
||||||
|
* semaphores and mutexes have a length of 1, and counting semaphores have a
|
||||||
|
* length set by their maximum count value. Examples:
|
||||||
|
* + If a queue set is to hold a queue of length 5, another queue of length 12,
|
||||||
|
* and a binary semaphore, then uxEventQueueLength should be set to
|
||||||
|
* (5 + 12 + 1), or 18.
|
||||||
|
* + If a queue set is to hold three binary semaphores then uxEventQueueLength
|
||||||
|
* should be set to (1 + 1 + 1 ), or 3.
|
||||||
|
* + If a queue set is to hold a counting semaphore that has a maximum count of
|
||||||
|
* 5, and a counting semaphore that has a maximum count of 3, then
|
||||||
|
* uxEventQueueLength should be set to (5 + 3), or 8.
|
||||||
|
*
|
||||||
|
* @param pucQueueStorage pucQueueStorage must point to a uint8_t array that is
|
||||||
|
* at least large enough to hold uxEventQueueLength events.
|
||||||
|
*
|
||||||
|
* @param pxQueueBuffer Must point to a variable of type StaticQueue_t, which
|
||||||
|
* will be used to hold the queue's data structure.
|
||||||
|
*
|
||||||
|
* @return If the queue set is created successfully then a handle to the created
|
||||||
|
* queue set is returned. If pxQueueBuffer is NULL then NULL is returned.
|
||||||
|
*/
|
||||||
|
#if ( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
|
||||||
|
QueueSetHandle_t xQueueCreateSetStatic( const UBaseType_t uxEventQueueLength,
|
||||||
|
uint8_t * pucQueueStorage,
|
||||||
|
StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adds a queue or semaphore to a queue set that was previously created by a
|
* Adds a queue or semaphore to a queue set that was previously created by a
|
||||||
* call to xQueueCreateSet().
|
* call to xQueueCreateSet() or xQueueCreateSetStatic().
|
||||||
*
|
*
|
||||||
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
|
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
|
||||||
* function.
|
* function.
|
||||||
|
@ -1677,8 +1765,10 @@ QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILE
|
||||||
* queue set because it is already a member of a different queue set then pdFAIL
|
* queue set because it is already a member of a different queue set then pdFAIL
|
||||||
* is returned.
|
* is returned.
|
||||||
*/
|
*/
|
||||||
|
#if ( configUSE_QUEUE_SETS == 1 )
|
||||||
BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
||||||
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Removes a queue or semaphore from a queue set. A queue or semaphore can only
|
* Removes a queue or semaphore from a queue set. A queue or semaphore can only
|
||||||
|
@ -1697,8 +1787,10 @@ BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
||||||
* then pdPASS is returned. If the queue was not in the queue set, or the
|
* then pdPASS is returned. If the queue was not in the queue set, or the
|
||||||
* queue (or semaphore) was not empty, then pdFAIL is returned.
|
* queue (or semaphore) was not empty, then pdFAIL is returned.
|
||||||
*/
|
*/
|
||||||
|
#if ( configUSE_QUEUE_SETS == 1 )
|
||||||
BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
||||||
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xQueueSelectFromSet() selects from the members of a queue set a queue or
|
* xQueueSelectFromSet() selects from the members of a queue set a queue or
|
||||||
|
@ -1710,7 +1802,7 @@ BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
||||||
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
|
* See FreeRTOS/Source/Demo/Common/Minimal/QueueSet.c for an example using this
|
||||||
* function.
|
* function.
|
||||||
*
|
*
|
||||||
* Note 1: See the documentation on https://www.FreeRTOS.org/RTOS-queue-sets.html
|
* Note 1: See the documentation on https://www.freertos.org/Documentation/02-Kernel/04-API-references/07-Queue-sets/00-RTOS-queue-sets
|
||||||
* for reasons why queue sets are very rarely needed in practice as there are
|
* for reasons why queue sets are very rarely needed in practice as there are
|
||||||
* simpler methods of blocking on multiple objects.
|
* simpler methods of blocking on multiple objects.
|
||||||
*
|
*
|
||||||
|
@ -1734,13 +1826,17 @@ BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
|
||||||
* in the queue set that is available, or NULL if no such queue or semaphore
|
* in the queue set that is available, or NULL if no such queue or semaphore
|
||||||
* exists before before the specified block time expires.
|
* exists before before the specified block time expires.
|
||||||
*/
|
*/
|
||||||
|
#if ( configUSE_QUEUE_SETS == 1 )
|
||||||
QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet,
|
QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet,
|
||||||
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A version of xQueueSelectFromSet() that can be used from an ISR.
|
* A version of xQueueSelectFromSet() that can be used from an ISR.
|
||||||
*/
|
*/
|
||||||
|
#if ( configUSE_QUEUE_SETS == 1 )
|
||||||
QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Not public API functions. */
|
/* Not public API functions. */
|
||||||
void vQueueWaitForMessageRestricted( QueueHandle_t xQueue,
|
void vQueueWaitForMessageRestricted( QueueHandle_t xQueue,
|
||||||
|
@ -1748,11 +1844,22 @@ void vQueueWaitForMessageRestricted( QueueHandle_t xQueue,
|
||||||
const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;
|
const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
|
||||||
BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
|
BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||||
void vQueueSetQueueNumber( QueueHandle_t xQueue,
|
void vQueueSetQueueNumber( QueueHandle_t xQueue,
|
||||||
UBaseType_t uxQueueNumber ) PRIVILEGED_FUNCTION;
|
UBaseType_t uxQueueNumber ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||||
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||||
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
UBaseType_t uxQueueGetQueueLength( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1193,7 +1193,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||||
/**
|
/**
|
||||||
* semphr.h
|
* semphr.h
|
||||||
* @code{c}
|
* @code{c}
|
||||||
* BaseType_t xSemaphoreGetStaticBuffer( SemaphoreHandle_t xSemaphore );
|
* BaseType_t xSemaphoreGetStaticBuffer( SemaphoreHandle_t xSemaphore,
|
||||||
|
* StaticSemaphore_t ** ppxSemaphoreBuffer );
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* Retrieve pointer to a statically created binary semaphore, counting semaphore,
|
* Retrieve pointer to a statically created binary semaphore, counting semaphore,
|
||||||
|
|
|
@ -53,60 +53,78 @@
|
||||||
#define portSTACK_LIMIT_PADDING 0
|
#define portSTACK_LIMIT_PADDING 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
|
/* Stack overflow check is not straight forward to implement for MPU ports
|
||||||
|
* because of the following reasons:
|
||||||
|
* 1. The context is stored in TCB and as a result, pxTopOfStack member points
|
||||||
|
* to the context location in TCB.
|
||||||
|
* 2. System calls are executed on a separate privileged only stack.
|
||||||
|
*
|
||||||
|
* It is still okay because an MPU region is used to protect task stack which
|
||||||
|
* means task stack overflow will trigger an MPU fault for unprivileged tasks.
|
||||||
|
* Additionally, architectures with hardware stack overflow checking support
|
||||||
|
* (such as Armv8-M) will trigger a fault when a task's stack overflows.
|
||||||
|
*/
|
||||||
|
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
do { \
|
do \
|
||||||
|
{ \
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \
|
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \
|
||||||
{ \
|
{ \
|
||||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
|
||||||
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
|
#if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
||||||
|
|
||||||
/* Only the current stack state is to be checked. */
|
/* Only the current stack state is to be checked. */
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
do { \
|
do \
|
||||||
\
|
{ \
|
||||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \
|
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \
|
||||||
{ \
|
{ \
|
||||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
|
||||||
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
|
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
do { \
|
do \
|
||||||
|
{ \
|
||||||
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
|
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
|
||||||
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
|
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \
|
||||||
\
|
\
|
||||||
if( ( pulStack[ 0 ] != ulCheckValue ) || \
|
if( ( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) || \
|
||||||
|
( pulStack[ 0 ] != ulCheckValue ) || \
|
||||||
( pulStack[ 1 ] != ulCheckValue ) || \
|
( pulStack[ 1 ] != ulCheckValue ) || \
|
||||||
( pulStack[ 2 ] != ulCheckValue ) || \
|
( pulStack[ 2 ] != ulCheckValue ) || \
|
||||||
( pulStack[ 3 ] != ulCheckValue ) ) \
|
( pulStack[ 3 ] != ulCheckValue ) ) \
|
||||||
{ \
|
{ \
|
||||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
|
||||||
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
|
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) )
|
||||||
|
|
||||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||||
do { \
|
do \
|
||||||
|
{ \
|
||||||
int8_t * pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
|
int8_t * pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
|
||||||
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
@ -114,13 +132,13 @@
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
|
||||||
\
|
\
|
||||||
\
|
|
||||||
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
|
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
|
||||||
\
|
\
|
||||||
/* Has the extremity of the task stack ever been written over? */ \
|
if( ( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) || \
|
||||||
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) ) \
|
||||||
{ \
|
{ \
|
||||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \
|
||||||
|
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
|
|
|
@ -40,12 +40,12 @@
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xStreamBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xStreamBufferReceive()) inside a critical section section and set the
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* receive block time to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -62,6 +62,13 @@
|
||||||
#endif
|
#endif
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of stream buffer. For internal use only.
|
||||||
|
*/
|
||||||
|
#define sbTYPE_STREAM_BUFFER ( ( BaseType_t ) 0 )
|
||||||
|
#define sbTYPE_MESSAGE_BUFFER ( ( BaseType_t ) 1 )
|
||||||
|
#define sbTYPE_STREAM_BATCHING_BUFFER ( ( BaseType_t ) 2 )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type by which stream buffers are referenced. For example, a call to
|
* Type by which stream buffers are referenced. For example, a call to
|
||||||
* xStreamBufferCreate() returns an StreamBufferHandle_t variable that can
|
* xStreamBufferCreate() returns an StreamBufferHandle_t variable that can
|
||||||
|
@ -91,6 +98,8 @@ typedef void (* StreamBufferCallbackFunction_t)( StreamBufferHandle_t xStreamBuf
|
||||||
*
|
*
|
||||||
* configSUPPORT_DYNAMIC_ALLOCATION must be set to 1 or left undefined in
|
* configSUPPORT_DYNAMIC_ALLOCATION must be set to 1 or left undefined in
|
||||||
* FreeRTOSConfig.h for xStreamBufferCreate() to be available.
|
* FreeRTOSConfig.h for xStreamBufferCreate() to be available.
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferCreate() to be available.
|
||||||
*
|
*
|
||||||
* @param xBufferSizeBytes The total number of bytes the stream buffer will be
|
* @param xBufferSizeBytes The total number of bytes the stream buffer will be
|
||||||
* able to hold at any one time.
|
* able to hold at any one time.
|
||||||
|
@ -155,11 +164,11 @@ typedef void (* StreamBufferCallbackFunction_t)( StreamBufferHandle_t xStreamBuf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define xStreamBufferCreate( xBufferSizeBytes, xTriggerLevelBytes ) \
|
#define xStreamBufferCreate( xBufferSizeBytes, xTriggerLevelBytes ) \
|
||||||
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), pdFALSE, NULL, NULL )
|
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), sbTYPE_STREAM_BUFFER, NULL, NULL )
|
||||||
|
|
||||||
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||||
#define xStreamBufferCreateWithCallback( xBufferSizeBytes, xTriggerLevelBytes, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
#define xStreamBufferCreateWithCallback( xBufferSizeBytes, xTriggerLevelBytes, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
||||||
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), pdFALSE, ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), sbTYPE_STREAM_BUFFER, ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,7 +184,9 @@ typedef void (* StreamBufferCallbackFunction_t)( StreamBufferHandle_t xStreamBuf
|
||||||
* xStreamBufferCreate() for a version that uses dynamically allocated memory.
|
* xStreamBufferCreate() for a version that uses dynamically allocated memory.
|
||||||
*
|
*
|
||||||
* configSUPPORT_STATIC_ALLOCATION must be set to 1 in FreeRTOSConfig.h for
|
* configSUPPORT_STATIC_ALLOCATION must be set to 1 in FreeRTOSConfig.h for
|
||||||
* xStreamBufferCreateStatic() to be available.
|
* xStreamBufferCreateStatic() to be available. configUSE_STREAM_BUFFERS must be
|
||||||
|
* set to 1 in for FreeRTOSConfig.h for xStreamBufferCreateStatic() to be
|
||||||
|
* available.
|
||||||
*
|
*
|
||||||
* @param xBufferSizeBytes The size, in bytes, of the buffer pointed to by the
|
* @param xBufferSizeBytes The size, in bytes, of the buffer pointed to by the
|
||||||
* pucStreamBufferStorageArea parameter.
|
* pucStreamBufferStorageArea parameter.
|
||||||
|
@ -253,11 +264,199 @@ typedef void (* StreamBufferCallbackFunction_t)( StreamBufferHandle_t xStreamBuf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define xStreamBufferCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer ) \
|
#define xStreamBufferCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer ) \
|
||||||
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), pdFALSE, ( pucStreamBufferStorageArea ), ( pxStaticStreamBuffer ), NULL, NULL )
|
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), sbTYPE_STREAM_BUFFER, ( pucStreamBufferStorageArea ), ( pxStaticStreamBuffer ), NULL, NULL )
|
||||||
|
|
||||||
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||||
#define xStreamBufferCreateStaticWithCallback( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
#define xStreamBufferCreateStaticWithCallback( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
||||||
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), pdFALSE, ( pucStreamBufferStorageArea ), ( pxStaticStreamBuffer ), ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), sbTYPE_STREAM_BUFFER, ( pucStreamBufferStorageArea ), ( pxStaticStreamBuffer ), ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stream_buffer.h
|
||||||
|
*
|
||||||
|
* @code{c}
|
||||||
|
* StreamBufferHandle_t xStreamBatchingBufferCreate( size_t xBufferSizeBytes, size_t xTriggerLevelBytes );
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* Creates a new stream batching buffer using dynamically allocated memory. See
|
||||||
|
* xStreamBatchingBufferCreateStatic() for a version that uses statically
|
||||||
|
* allocated memory (memory that is allocated at compile time).
|
||||||
|
*
|
||||||
|
* configSUPPORT_DYNAMIC_ALLOCATION must be set to 1 or left undefined in
|
||||||
|
* FreeRTOSConfig.h for xStreamBatchingBufferCreate() to be available.
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBatchingBufferCreate() to be available.
|
||||||
|
*
|
||||||
|
* The difference between a stream buffer and a stream batching buffer is when
|
||||||
|
* a task performs read on a non-empty buffer:
|
||||||
|
* - The task reading from a non-empty stream buffer returns immediately
|
||||||
|
* regardless of the amount of data in the buffer.
|
||||||
|
* - The task reading from a non-empty steam batching buffer blocks until the
|
||||||
|
* amount of data in the buffer exceeds the trigger level or the block time
|
||||||
|
* expires.
|
||||||
|
*
|
||||||
|
* @param xBufferSizeBytes The total number of bytes the stream batching buffer
|
||||||
|
* will be able to hold at any one time.
|
||||||
|
*
|
||||||
|
* @param xTriggerLevelBytes The number of bytes that must be in the stream
|
||||||
|
* batching buffer to unblock a task calling xStreamBufferReceive before the
|
||||||
|
* block time expires.
|
||||||
|
*
|
||||||
|
* @param pxSendCompletedCallback Callback invoked when number of bytes at least
|
||||||
|
* equal to trigger level is sent to the stream batching buffer. If the
|
||||||
|
* parameter is NULL, it will use the default implementation provided by
|
||||||
|
* sbSEND_COMPLETED macro. To enable the callback, configUSE_SB_COMPLETED_CALLBACK
|
||||||
|
* must be set to 1 in FreeRTOSConfig.h.
|
||||||
|
*
|
||||||
|
* @param pxReceiveCompletedCallback Callback invoked when more than zero bytes
|
||||||
|
* are read from a stream batching buffer. If the parameter is NULL, it will use
|
||||||
|
* the default implementation provided by sbRECEIVE_COMPLETED macro. To enable
|
||||||
|
* the callback, configUSE_SB_COMPLETED_CALLBACK must be set to 1 in
|
||||||
|
* FreeRTOSConfig.h.
|
||||||
|
*
|
||||||
|
* @return If NULL is returned, then the stream batching buffer cannot be created
|
||||||
|
* because there is insufficient heap memory available for FreeRTOS to allocate
|
||||||
|
* the stream batching buffer data structures and storage area. A non-NULL value
|
||||||
|
* being returned indicates that the stream batching buffer has been created
|
||||||
|
* successfully - the returned value should be stored as the handle to the
|
||||||
|
* created stream batching buffer.
|
||||||
|
*
|
||||||
|
* Example use:
|
||||||
|
* @code{c}
|
||||||
|
*
|
||||||
|
* void vAFunction( void )
|
||||||
|
* {
|
||||||
|
* StreamBufferHandle_t xStreamBatchingBuffer;
|
||||||
|
* const size_t xStreamBufferSizeBytes = 100, xTriggerLevel = 10;
|
||||||
|
*
|
||||||
|
* // Create a stream batching buffer that can hold 100 bytes. The memory used
|
||||||
|
* // to hold both the stream batching buffer structure and the data in the stream
|
||||||
|
* // batching buffer is allocated dynamically.
|
||||||
|
* xStreamBatchingBuffer = xStreamBatchingBufferCreate( xStreamBufferSizeBytes, xTriggerLevel );
|
||||||
|
*
|
||||||
|
* if( xStreamBatchingBuffer == NULL )
|
||||||
|
* {
|
||||||
|
* // There was not enough heap memory space available to create the
|
||||||
|
* // stream batching buffer.
|
||||||
|
* }
|
||||||
|
* else
|
||||||
|
* {
|
||||||
|
* // The stream batching buffer was created successfully and can now be used.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
* \defgroup xStreamBatchingBufferCreate xStreamBatchingBufferCreate
|
||||||
|
* \ingroup StreamBatchingBufferManagement
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define xStreamBatchingBufferCreate( xBufferSizeBytes, xTriggerLevelBytes ) \
|
||||||
|
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), sbTYPE_STREAM_BATCHING_BUFFER, NULL, NULL )
|
||||||
|
|
||||||
|
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||||
|
#define xStreamBatchingBufferCreateWithCallback( xBufferSizeBytes, xTriggerLevelBytes, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
||||||
|
xStreamBufferGenericCreate( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), sbTYPE_STREAM_BATCHING_BUFFER, ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stream_buffer.h
|
||||||
|
*
|
||||||
|
* @code{c}
|
||||||
|
* StreamBufferHandle_t xStreamBatchingBufferCreateStatic( size_t xBufferSizeBytes,
|
||||||
|
* size_t xTriggerLevelBytes,
|
||||||
|
* uint8_t *pucStreamBufferStorageArea,
|
||||||
|
* StaticStreamBuffer_t *pxStaticStreamBuffer );
|
||||||
|
* @endcode
|
||||||
|
* Creates a new stream batching buffer using statically allocated memory. See
|
||||||
|
* xStreamBatchingBufferCreate() for a version that uses dynamically allocated
|
||||||
|
* memory.
|
||||||
|
*
|
||||||
|
* configSUPPORT_STATIC_ALLOCATION must be set to 1 in FreeRTOSConfig.h for
|
||||||
|
* xStreamBatchingBufferCreateStatic() to be available. configUSE_STREAM_BUFFERS
|
||||||
|
* must be set to 1 in for FreeRTOSConfig.h for xStreamBatchingBufferCreateStatic()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
|
* The difference between a stream buffer and a stream batching buffer is when
|
||||||
|
* a task performs read on a non-empty buffer:
|
||||||
|
* - The task reading from a non-empty stream buffer returns immediately
|
||||||
|
* regardless of the amount of data in the buffer.
|
||||||
|
* - The task reading from a non-empty steam batching buffer blocks until the
|
||||||
|
* amount of data in the buffer exceeds the trigger level or the block time
|
||||||
|
* expires.
|
||||||
|
*
|
||||||
|
* @param xBufferSizeBytes The size, in bytes, of the buffer pointed to by the
|
||||||
|
* pucStreamBufferStorageArea parameter.
|
||||||
|
*
|
||||||
|
* @param xTriggerLevelBytes The number of bytes that must be in the stream
|
||||||
|
* batching buffer to unblock a task calling xStreamBufferReceive before the
|
||||||
|
* block time expires.
|
||||||
|
*
|
||||||
|
* @param pucStreamBufferStorageArea Must point to a uint8_t array that is at
|
||||||
|
* least xBufferSizeBytes big. This is the array to which streams are
|
||||||
|
* copied when they are written to the stream batching buffer.
|
||||||
|
*
|
||||||
|
* @param pxStaticStreamBuffer Must point to a variable of type
|
||||||
|
* StaticStreamBuffer_t, which will be used to hold the stream batching buffer's
|
||||||
|
* data structure.
|
||||||
|
*
|
||||||
|
* @param pxSendCompletedCallback Callback invoked when number of bytes at least
|
||||||
|
* equal to trigger level is sent to the stream batching buffer. If the parameter
|
||||||
|
* is NULL, it will use the default implementation provided by sbSEND_COMPLETED
|
||||||
|
* macro. To enable the callback, configUSE_SB_COMPLETED_CALLBACK must be set to
|
||||||
|
* 1 in FreeRTOSConfig.h.
|
||||||
|
*
|
||||||
|
* @param pxReceiveCompletedCallback Callback invoked when more than zero bytes
|
||||||
|
* are read from a stream batching buffer. If the parameter is NULL, it will use
|
||||||
|
* the default implementation provided by sbRECEIVE_COMPLETED macro. To enable
|
||||||
|
* the callback, configUSE_SB_COMPLETED_CALLBACK must be set to 1 in
|
||||||
|
* FreeRTOSConfig.h.
|
||||||
|
*
|
||||||
|
* @return If the stream batching buffer is created successfully then a handle
|
||||||
|
* to the created stream batching buffer is returned. If either pucStreamBufferStorageArea
|
||||||
|
* or pxStaticstreamBuffer are NULL then NULL is returned.
|
||||||
|
*
|
||||||
|
* Example use:
|
||||||
|
* @code{c}
|
||||||
|
*
|
||||||
|
* // Used to dimension the array used to hold the streams. The available space
|
||||||
|
* // will actually be one less than this, so 999.
|
||||||
|
* #define STORAGE_SIZE_BYTES 1000
|
||||||
|
*
|
||||||
|
* // Defines the memory that will actually hold the streams within the stream
|
||||||
|
* // batching buffer.
|
||||||
|
* static uint8_t ucStorageBuffer[ STORAGE_SIZE_BYTES ];
|
||||||
|
*
|
||||||
|
* // The variable used to hold the stream batching buffer structure.
|
||||||
|
* StaticStreamBuffer_t xStreamBufferStruct;
|
||||||
|
*
|
||||||
|
* void MyFunction( void )
|
||||||
|
* {
|
||||||
|
* StreamBufferHandle_t xStreamBatchingBuffer;
|
||||||
|
* const size_t xTriggerLevel = 1;
|
||||||
|
*
|
||||||
|
* xStreamBatchingBuffer = xStreamBatchingBufferCreateStatic( sizeof( ucStorageBuffer ),
|
||||||
|
* xTriggerLevel,
|
||||||
|
* ucStorageBuffer,
|
||||||
|
* &xStreamBufferStruct );
|
||||||
|
*
|
||||||
|
* // As neither the pucStreamBufferStorageArea or pxStaticStreamBuffer
|
||||||
|
* // parameters were NULL, xStreamBatchingBuffer will not be NULL, and can be
|
||||||
|
* // used to reference the created stream batching buffer in other stream
|
||||||
|
* // buffer API calls.
|
||||||
|
*
|
||||||
|
* // Other code that uses the stream batching buffer can go here.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @endcode
|
||||||
|
* \defgroup xStreamBatchingBufferCreateStatic xStreamBatchingBufferCreateStatic
|
||||||
|
* \ingroup StreamBatchingBufferManagement
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define xStreamBatchingBufferCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer ) \
|
||||||
|
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), sbTYPE_STREAM_BATCHING_BUFFER, ( pucStreamBufferStorageArea ), ( pxStaticStreamBuffer ), NULL, NULL )
|
||||||
|
|
||||||
|
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
|
||||||
|
#define xStreamBatchingBufferCreateStaticWithCallback( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback ) \
|
||||||
|
xStreamBufferGenericCreateStatic( ( xBufferSizeBytes ), ( xTriggerLevelBytes ), sbTYPE_STREAM_BATCHING_BUFFER, ( pucStreamBufferStorageArea ), ( pxStaticStreamBuffer ), ( pxSendCompletedCallback ), ( pxReceiveCompletedCallback ) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -273,6 +472,9 @@ typedef void (* StreamBufferCallbackFunction_t)( StreamBufferHandle_t xStreamBuf
|
||||||
* buffer and storage area buffer. These are the same buffers that are supplied
|
* buffer and storage area buffer. These are the same buffers that are supplied
|
||||||
* at the time of creation.
|
* at the time of creation.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferGetStaticBuffers() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The stream buffer for which to retrieve the buffers.
|
* @param xStreamBuffer The stream buffer for which to retrieve the buffers.
|
||||||
*
|
*
|
||||||
* @param ppucStreamBufferStorageArea Used to return a pointer to the stream
|
* @param ppucStreamBufferStorageArea Used to return a pointer to the stream
|
||||||
|
@ -312,17 +514,20 @@ typedef void (* StreamBufferCallbackFunction_t)( StreamBufferHandle_t xStreamBuf
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xStreamBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xStreamBufferReceive()) inside a critical section and set the receive
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* block time to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
* Use xStreamBufferSend() to write to a stream buffer from a task. Use
|
* Use xStreamBufferSend() to write to a stream buffer from a task. Use
|
||||||
* xStreamBufferSendFromISR() to write to a stream buffer from an interrupt
|
* xStreamBufferSendFromISR() to write to a stream buffer from an interrupt
|
||||||
* service routine (ISR).
|
* service routine (ISR).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferSend() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer to which a stream is
|
* @param xStreamBuffer The handle of the stream buffer to which a stream is
|
||||||
* being sent.
|
* being sent.
|
||||||
*
|
*
|
||||||
|
@ -410,17 +615,20 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xStreamBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xStreamBufferReceive()) inside a critical section and set the receive
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* block time to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
* Use xStreamBufferSend() to write to a stream buffer from a task. Use
|
* Use xStreamBufferSend() to write to a stream buffer from a task. Use
|
||||||
* xStreamBufferSendFromISR() to write to a stream buffer from an interrupt
|
* xStreamBufferSendFromISR() to write to a stream buffer from an interrupt
|
||||||
* service routine (ISR).
|
* service routine (ISR).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferSendFromISR() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer to which a stream is
|
* @param xStreamBuffer The handle of the stream buffer to which a stream is
|
||||||
* being sent.
|
* being sent.
|
||||||
*
|
*
|
||||||
|
@ -510,17 +718,20 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
|
||||||
* writer and reader to be different tasks or interrupts, but, unlike other
|
* writer and reader to be different tasks or interrupts, but, unlike other
|
||||||
* FreeRTOS objects, it is not safe to have multiple different writers or
|
* FreeRTOS objects, it is not safe to have multiple different writers or
|
||||||
* multiple different readers. If there are to be multiple different writers
|
* multiple different readers. If there are to be multiple different writers
|
||||||
* then the application writer must place each call to a writing API function
|
* then the application writer must serialize calls to writing API functions
|
||||||
* (such as xStreamBufferSend()) inside a critical section and set the send
|
* (such as xStreamBufferSend()). Likewise, if there are to be multiple
|
||||||
* block time to 0. Likewise, if there are to be multiple different readers
|
* different readers then the application writer must serialize calls to reading
|
||||||
* then the application writer must place each call to a reading API function
|
* API functions (such as xStreamBufferReceive()). One way to achieve such
|
||||||
* (such as xStreamBufferReceive()) inside a critical section and set the receive
|
* serialization in single core or SMP kernel is to place each API call inside a
|
||||||
* block time to 0.
|
* critical section and use a block time of 0.
|
||||||
*
|
*
|
||||||
* Use xStreamBufferReceive() to read from a stream buffer from a task. Use
|
* Use xStreamBufferReceive() to read from a stream buffer from a task. Use
|
||||||
* xStreamBufferReceiveFromISR() to read from a stream buffer from an
|
* xStreamBufferReceiveFromISR() to read from a stream buffer from an
|
||||||
* interrupt service routine (ISR).
|
* interrupt service routine (ISR).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferReceive() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer from which bytes are to
|
* @param xStreamBuffer The handle of the stream buffer from which bytes are to
|
||||||
* be received.
|
* be received.
|
||||||
*
|
*
|
||||||
|
@ -596,6 +807,9 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
|
||||||
* Use xStreamBufferReceiveFromISR() to read bytes from a stream buffer from an
|
* Use xStreamBufferReceiveFromISR() to read bytes from a stream buffer from an
|
||||||
* interrupt service routine (ISR).
|
* interrupt service routine (ISR).
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferReceiveFromISR() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer from which a stream
|
* @param xStreamBuffer The handle of the stream buffer from which a stream
|
||||||
* is being received.
|
* is being received.
|
||||||
*
|
*
|
||||||
|
@ -680,6 +894,9 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
|
||||||
* A stream buffer handle must not be used after the stream buffer has been
|
* A stream buffer handle must not be used after the stream buffer has been
|
||||||
* deleted.
|
* deleted.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* vStreamBufferDelete() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer to be deleted.
|
* @param xStreamBuffer The handle of the stream buffer to be deleted.
|
||||||
*
|
*
|
||||||
* \defgroup vStreamBufferDelete vStreamBufferDelete
|
* \defgroup vStreamBufferDelete vStreamBufferDelete
|
||||||
|
@ -697,6 +914,9 @@ void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTI
|
||||||
* Queries a stream buffer to see if it is full. A stream buffer is full if it
|
* Queries a stream buffer to see if it is full. A stream buffer is full if it
|
||||||
* does not have any free space, and therefore cannot accept any more data.
|
* does not have any free space, and therefore cannot accept any more data.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferIsFull() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer being queried.
|
* @param xStreamBuffer The handle of the stream buffer being queried.
|
||||||
*
|
*
|
||||||
* @return If the stream buffer is full then pdTRUE is returned. Otherwise
|
* @return If the stream buffer is full then pdTRUE is returned. Otherwise
|
||||||
|
@ -717,6 +937,9 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_
|
||||||
* Queries a stream buffer to see if it is empty. A stream buffer is empty if
|
* Queries a stream buffer to see if it is empty. A stream buffer is empty if
|
||||||
* it does not contain any data.
|
* it does not contain any data.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferIsEmpty() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer being queried.
|
* @param xStreamBuffer The handle of the stream buffer being queried.
|
||||||
*
|
*
|
||||||
* @return If the stream buffer is empty then pdTRUE is returned. Otherwise
|
* @return If the stream buffer is empty then pdTRUE is returned. Otherwise
|
||||||
|
@ -739,6 +962,13 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED
|
||||||
* are no tasks blocked waiting to either send to or receive from the stream
|
* are no tasks blocked waiting to either send to or receive from the stream
|
||||||
* buffer.
|
* buffer.
|
||||||
*
|
*
|
||||||
|
* Use xStreamBufferReset() to reset a stream buffer from a task.
|
||||||
|
* Use xStreamBufferResetFromISR() to reset a stream buffer from an
|
||||||
|
* interrupt service routine (ISR).
|
||||||
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferReset() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer being reset.
|
* @param xStreamBuffer The handle of the stream buffer being reset.
|
||||||
*
|
*
|
||||||
* @return If the stream buffer is reset then pdPASS is returned. If there was
|
* @return If the stream buffer is reset then pdPASS is returned. If there was
|
||||||
|
@ -750,6 +980,38 @@ BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED
|
||||||
*/
|
*/
|
||||||
BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stream_buffer.h
|
||||||
|
*
|
||||||
|
* @code{c}
|
||||||
|
* BaseType_t xStreamBufferResetFromISR( StreamBufferHandle_t xStreamBuffer );
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* An interrupt safe version of the API function that resets the stream buffer.
|
||||||
|
*
|
||||||
|
* Resets a stream buffer to its initial, empty, state. Any data that was in
|
||||||
|
* the stream buffer is discarded. A stream buffer can only be reset if there
|
||||||
|
* are no tasks blocked waiting to either send to or receive from the stream
|
||||||
|
* buffer.
|
||||||
|
*
|
||||||
|
* Use xStreamBufferReset() to reset a stream buffer from a task.
|
||||||
|
* Use xStreamBufferResetFromISR() to reset a stream buffer from an
|
||||||
|
* interrupt service routine (ISR).
|
||||||
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferResetFromISR() to be available.
|
||||||
|
*
|
||||||
|
* @param xStreamBuffer The handle of the stream buffer being reset.
|
||||||
|
*
|
||||||
|
* @return If the stream buffer is reset then pdPASS is returned. If there was
|
||||||
|
* a task blocked waiting to send to or read from the stream buffer then the
|
||||||
|
* stream buffer is not reset and pdFAIL is returned.
|
||||||
|
*
|
||||||
|
* \defgroup xStreamBufferResetFromISR xStreamBufferResetFromISR
|
||||||
|
* \ingroup StreamBufferManagement
|
||||||
|
*/
|
||||||
|
BaseType_t xStreamBufferResetFromISR( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stream_buffer.h
|
* stream_buffer.h
|
||||||
*
|
*
|
||||||
|
@ -761,6 +1023,9 @@ BaseType_t xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_F
|
||||||
* equal to the amount of data that can be sent to the stream buffer before it
|
* equal to the amount of data that can be sent to the stream buffer before it
|
||||||
* is full.
|
* is full.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferSpacesAvailable() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer being queried.
|
* @param xStreamBuffer The handle of the stream buffer being queried.
|
||||||
*
|
*
|
||||||
* @return The number of bytes that can be written to the stream buffer before
|
* @return The number of bytes that can be written to the stream buffer before
|
||||||
|
@ -782,6 +1047,9 @@ size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVIL
|
||||||
* the number of bytes that can be read from the stream buffer before the stream
|
* the number of bytes that can be read from the stream buffer before the stream
|
||||||
* buffer would be empty.
|
* buffer would be empty.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferBytesAvailable() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer being queried.
|
* @param xStreamBuffer The handle of the stream buffer being queried.
|
||||||
*
|
*
|
||||||
* @return The number of bytes that can be read from the stream buffer before
|
* @return The number of bytes that can be read from the stream buffer before
|
||||||
|
@ -816,6 +1084,9 @@ size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) PRIVILE
|
||||||
* A trigger level is set when the stream buffer is created, and can be modified
|
* A trigger level is set when the stream buffer is created, and can be modified
|
||||||
* using xStreamBufferSetTriggerLevel().
|
* using xStreamBufferSetTriggerLevel().
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferSetTriggerLevel() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer being updated.
|
* @param xStreamBuffer The handle of the stream buffer being updated.
|
||||||
*
|
*
|
||||||
* @param xTriggerLevel The new trigger level for the stream buffer.
|
* @param xTriggerLevel The new trigger level for the stream buffer.
|
||||||
|
@ -850,6 +1121,9 @@ BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer,
|
||||||
* See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for
|
* See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for
|
||||||
* additional information.
|
* additional information.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferSendCompletedFromISR() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer to which data was
|
* @param xStreamBuffer The handle of the stream buffer to which data was
|
||||||
* written.
|
* written.
|
||||||
*
|
*
|
||||||
|
@ -891,6 +1165,9 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer
|
||||||
* See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for
|
* See the example implemented in FreeRTOS/Demo/Minimal/MessageBufferAMP.c for
|
||||||
* additional information.
|
* additional information.
|
||||||
*
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* xStreamBufferReceiveCompletedFromISR() to be available.
|
||||||
|
*
|
||||||
* @param xStreamBuffer The handle of the stream buffer from which data was
|
* @param xStreamBuffer The handle of the stream buffer from which data was
|
||||||
* read.
|
* read.
|
||||||
*
|
*
|
||||||
|
@ -911,21 +1188,79 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer
|
||||||
BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
|
BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
|
||||||
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stream_buffer.h
|
||||||
|
*
|
||||||
|
* @code{c}
|
||||||
|
* UBaseType_t uxStreamBufferGetStreamBufferNotificationIndex( StreamBufferHandle_t xStreamBuffer );
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* Get the task notification index used for the supplied stream buffer which can
|
||||||
|
* be set using vStreamBufferSetStreamBufferNotificationIndex. If the task
|
||||||
|
* notification index for the stream buffer is not changed using
|
||||||
|
* vStreamBufferSetStreamBufferNotificationIndex, this function returns the
|
||||||
|
* default value (tskDEFAULT_INDEX_TO_NOTIFY).
|
||||||
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* uxStreamBufferGetStreamBufferNotificationIndex() to be available.
|
||||||
|
*
|
||||||
|
* @param xStreamBuffer The handle of the stream buffer for which the task
|
||||||
|
* notification index is retrieved.
|
||||||
|
*
|
||||||
|
* @return The task notification index for the stream buffer.
|
||||||
|
*
|
||||||
|
* \defgroup uxStreamBufferGetStreamBufferNotificationIndex uxStreamBufferGetStreamBufferNotificationIndex
|
||||||
|
* \ingroup StreamBufferManagement
|
||||||
|
*/
|
||||||
|
UBaseType_t uxStreamBufferGetStreamBufferNotificationIndex( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stream_buffer.h
|
||||||
|
*
|
||||||
|
* @code{c}
|
||||||
|
* void vStreamBufferSetStreamBufferNotificationIndex ( StreamBuffer_t xStreamBuffer, UBaseType_t uxNotificationIndex );
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* Set the task notification index used for the supplied stream buffer.
|
||||||
|
* Successive calls to stream buffer APIs (like xStreamBufferSend or
|
||||||
|
* xStreamBufferReceive) for this stream buffer will use this new index for
|
||||||
|
* their task notifications.
|
||||||
|
*
|
||||||
|
* If this function is not called, the default index (tskDEFAULT_INDEX_TO_NOTIFY)
|
||||||
|
* is used for task notifications. It is recommended to call this function
|
||||||
|
* before attempting to send or receive data from the stream buffer to avoid
|
||||||
|
* inconsistencies.
|
||||||
|
*
|
||||||
|
* configUSE_STREAM_BUFFERS must be set to 1 in for FreeRTOSConfig.h for
|
||||||
|
* vStreamBufferSetStreamBufferNotificationIndex() to be available.
|
||||||
|
*
|
||||||
|
* @param xStreamBuffer The handle of the stream buffer for which the task
|
||||||
|
* notification index is set.
|
||||||
|
*
|
||||||
|
* @param uxNotificationIndex The task notification index to set.
|
||||||
|
*
|
||||||
|
* \defgroup vStreamBufferSetStreamBufferNotificationIndex vStreamBufferSetStreamBufferNotificationIndex
|
||||||
|
* \ingroup StreamBufferManagement
|
||||||
|
*/
|
||||||
|
void vStreamBufferSetStreamBufferNotificationIndex( StreamBufferHandle_t xStreamBuffer,
|
||||||
|
UBaseType_t uxNotificationIndex ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* Functions below here are not part of the public API. */
|
/* Functions below here are not part of the public API. */
|
||||||
StreamBufferHandle_t xStreamBufferGenericCreate( size_t xBufferSizeBytes,
|
StreamBufferHandle_t xStreamBufferGenericCreate( size_t xBufferSizeBytes,
|
||||||
size_t xTriggerLevelBytes,
|
size_t xTriggerLevelBytes,
|
||||||
BaseType_t xIsMessageBuffer,
|
BaseType_t xStreamBufferType,
|
||||||
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||||
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
|
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||||
StreamBufferHandle_t xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
|
StreamBufferHandle_t xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
|
||||||
size_t xTriggerLevelBytes,
|
size_t xTriggerLevelBytes,
|
||||||
BaseType_t xIsMessageBuffer,
|
BaseType_t xStreamBufferType,
|
||||||
uint8_t * const pucStreamBufferStorageArea,
|
uint8_t * const pucStreamBufferStorageArea,
|
||||||
StaticStreamBuffer_t * const pxStaticStreamBuffer,
|
StaticStreamBuffer_t * const pxStaticStreamBuffer,
|
||||||
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
StreamBufferCallbackFunction_t pxSendCompletedCallback,
|
||||||
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
|
StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
699
include/task.h
699
include/task.h
File diff suppressed because it is too large
Load diff
|
@ -34,10 +34,8 @@
|
||||||
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*lint -save -e537 This headers are only multiply included if the application code
|
|
||||||
* happens to also be including task.h. */
|
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
/*lint -restore */
|
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -88,8 +86,8 @@ typedef void (* TimerCallbackFunction_t)( TimerHandle_t xTimer );
|
||||||
* Defines the prototype to which functions used with the
|
* Defines the prototype to which functions used with the
|
||||||
* xTimerPendFunctionCallFromISR() function must conform.
|
* xTimerPendFunctionCallFromISR() function must conform.
|
||||||
*/
|
*/
|
||||||
typedef void (* PendedFunction_t)( void *,
|
typedef void (* PendedFunction_t)( void * arg1,
|
||||||
uint32_t );
|
uint32_t arg2 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
* TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
||||||
|
@ -229,7 +227,7 @@ typedef void (* PendedFunction_t)( void *,
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||||
TimerHandle_t xTimerCreate( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
||||||
const TickType_t xTimerPeriodInTicks,
|
const TickType_t xTimerPeriodInTicks,
|
||||||
const BaseType_t xAutoReload,
|
const BaseType_t xAutoReload,
|
||||||
void * const pvTimerID,
|
void * const pvTimerID,
|
||||||
|
@ -359,7 +357,7 @@ typedef void (* PendedFunction_t)( void *,
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||||
TimerHandle_t xTimerCreateStatic( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
TimerHandle_t xTimerCreateStatic( const char * const pcTimerName,
|
||||||
const TickType_t xTimerPeriodInTicks,
|
const TickType_t xTimerPeriodInTicks,
|
||||||
const BaseType_t xAutoReload,
|
const BaseType_t xAutoReload,
|
||||||
void * const pvTimerID,
|
void * const pvTimerID,
|
||||||
|
@ -739,12 +737,16 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||||
* // The key press event handler.
|
* // The key press event handler.
|
||||||
* void vKeyPressEventHandler( char cKey )
|
* void vKeyPressEventHandler( char cKey )
|
||||||
* {
|
* {
|
||||||
* // Ensure the LCD back-light is on, then reset the timer that is
|
* // Reset the timer that is responsible for turning the back-light off after
|
||||||
* // responsible for turning the back-light off after 5 seconds of
|
* // 5 seconds of key inactivity. Wait 10 ticks for the command to be
|
||||||
* // key inactivity. Wait 10 ticks for the command to be successfully sent
|
* // successfully sent if it cannot be sent immediately.
|
||||||
* // if it cannot be sent immediately.
|
* if( xTimerReset( xBacklightTimer, 10 ) == pdPASS )
|
||||||
|
* {
|
||||||
|
* // Turn on the LCD back-light. It will be turned off in the
|
||||||
|
* // vBacklightTimerCallback after 5 seconds of key inactivity.
|
||||||
* vSetBacklightState( BACKLIGHT_ON );
|
* vSetBacklightState( BACKLIGHT_ON );
|
||||||
* if( xTimerReset( xBacklightTimer, 100 ) != pdPASS )
|
* }
|
||||||
|
* else
|
||||||
* {
|
* {
|
||||||
* // The reset command was not executed successfully. Take appropriate
|
* // The reset command was not executed successfully. Take appropriate
|
||||||
* // action here.
|
* // action here.
|
||||||
|
@ -755,12 +757,11 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||||
*
|
*
|
||||||
* void main( void )
|
* void main( void )
|
||||||
* {
|
* {
|
||||||
* int32_t x;
|
|
||||||
*
|
*
|
||||||
* // Create then start the one-shot timer that is responsible for turning
|
* // Create then start the one-shot timer that is responsible for turning
|
||||||
* // the back-light off if no keys are pressed within a 5 second period.
|
* // the back-light off if no keys are pressed within a 5 second period.
|
||||||
* xBacklightTimer = xTimerCreate( "BacklightTimer", // Just a text name, not used by the kernel.
|
* xBacklightTimer = xTimerCreate( "BacklightTimer", // Just a text name, not used by the kernel.
|
||||||
* ( 5000 / portTICK_PERIOD_MS), // The timer period in ticks.
|
* pdMS_TO_TICKS( 5000 ), // The timer period in ticks.
|
||||||
* pdFALSE, // The timer is a one-shot timer.
|
* pdFALSE, // The timer is a one-shot timer.
|
||||||
* 0, // The id is not used by the callback so can take any value.
|
* 0, // The id is not used by the callback so can take any value.
|
||||||
* vBacklightTimerCallback // The callback function that switches the LCD back-light off.
|
* vBacklightTimerCallback // The callback function that switches the LCD back-light off.
|
||||||
|
@ -1198,10 +1199,12 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||||
* }
|
* }
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
|
#if ( INCLUDE_xTimerPendFunctionCall == 1 )
|
||||||
BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend,
|
BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend,
|
||||||
void * pvParameter1,
|
void * pvParameter1,
|
||||||
uint32_t ulParameter2,
|
uint32_t ulParameter2,
|
||||||
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
|
* BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
|
||||||
|
@ -1235,10 +1238,12 @@ BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend,
|
||||||
* timer daemon task, otherwise pdFALSE is returned.
|
* timer daemon task, otherwise pdFALSE is returned.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#if ( INCLUDE_xTimerPendFunctionCall == 1 )
|
||||||
BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
|
BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
|
||||||
void * pvParameter1,
|
void * pvParameter1,
|
||||||
uint32_t ulParameter2,
|
uint32_t ulParameter2,
|
||||||
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* const char * const pcTimerGetName( TimerHandle_t xTimer );
|
* const char * const pcTimerGetName( TimerHandle_t xTimer );
|
||||||
|
@ -1249,7 +1254,7 @@ BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
|
||||||
*
|
*
|
||||||
* @return The name assigned to the timer specified by the xTimer parameter.
|
* @return The name assigned to the timer specified by the xTimer parameter.
|
||||||
*/
|
*/
|
||||||
const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* void vTimerSetReloadMode( TimerHandle_t xTimer, const BaseType_t xAutoReload );
|
* void vTimerSetReloadMode( TimerHandle_t xTimer, const BaseType_t xAutoReload );
|
||||||
|
@ -1348,12 +1353,29 @@ TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||||
* for use by the kernel only.
|
* for use by the kernel only.
|
||||||
*/
|
*/
|
||||||
BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;
|
BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;
|
||||||
BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
|
|
||||||
|
/*
|
||||||
|
* Splitting the xTimerGenericCommand into two sub functions and making it a macro
|
||||||
|
* removes a recursion path when called from ISRs. This is primarily for the XCore
|
||||||
|
* XCC port which detects the recursion path and throws an error during compilation
|
||||||
|
* when this is not split.
|
||||||
|
*/
|
||||||
|
BaseType_t xTimerGenericCommandFromTask( TimerHandle_t xTimer,
|
||||||
const BaseType_t xCommandID,
|
const BaseType_t xCommandID,
|
||||||
const TickType_t xOptionalValue,
|
const TickType_t xOptionalValue,
|
||||||
BaseType_t * const pxHigherPriorityTaskWoken,
|
BaseType_t * const pxHigherPriorityTaskWoken,
|
||||||
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
BaseType_t xTimerGenericCommandFromISR( TimerHandle_t xTimer,
|
||||||
|
const BaseType_t xCommandID,
|
||||||
|
const TickType_t xOptionalValue,
|
||||||
|
BaseType_t * const pxHigherPriorityTaskWoken,
|
||||||
|
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#define xTimerGenericCommand( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ) \
|
||||||
|
( ( xCommandID ) < tmrFIRST_FROM_ISR_COMMAND ? \
|
||||||
|
xTimerGenericCommandFromTask( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ) : \
|
||||||
|
xTimerGenericCommandFromISR( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait ) )
|
||||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||||
void vTimerSetTimerNumber( TimerHandle_t xTimer,
|
void vTimerSetTimerNumber( TimerHandle_t xTimer,
|
||||||
UBaseType_t uxTimerNumber ) PRIVILEGED_FUNCTION;
|
UBaseType_t uxTimerNumber ) PRIVILEGED_FUNCTION;
|
||||||
|
@ -1365,7 +1387,7 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
|
||||||
/**
|
/**
|
||||||
* task.h
|
* task.h
|
||||||
* @code{c}
|
* @code{c}
|
||||||
* void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )
|
* void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, configSTACK_DEPTH_TYPE * puxTimerTaskStackSize )
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Timer Task TCB. This function is required when
|
* This function is used to provide a statically allocated block of memory to FreeRTOS to hold the Timer Task TCB. This function is required when
|
||||||
|
@ -1373,11 +1395,11 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
|
||||||
*
|
*
|
||||||
* @param ppxTimerTaskTCBBuffer A handle to a statically allocated TCB buffer
|
* @param ppxTimerTaskTCBBuffer A handle to a statically allocated TCB buffer
|
||||||
* @param ppxTimerTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
|
* @param ppxTimerTaskStackBuffer A handle to a statically allocated Stack buffer for the idle task
|
||||||
* @param pulTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
|
* @param puxTimerTaskStackSize A pointer to the number of elements that will fit in the allocated stack buffer
|
||||||
*/
|
*/
|
||||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||||
StackType_t ** ppxTimerTaskStackBuffer,
|
StackType_t ** ppxTimerTaskStackBuffer,
|
||||||
uint32_t * pulTimerTaskStackSize );
|
configSTACK_DEPTH_TYPE * puxTimerTaskStackSize );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1391,10 +1413,19 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer,
|
||||||
*
|
*
|
||||||
* This hook function is called form the timer task once when the task starts running.
|
* This hook function is called form the timer task once when the task starts running.
|
||||||
*/
|
*/
|
||||||
|
/* MISRA Ref 8.6.1 [External linkage] */
|
||||||
|
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-86 */
|
||||||
|
/* coverity[misra_c_2012_rule_8_6_violation] */
|
||||||
void vApplicationDaemonTaskStartupHook( void );
|
void vApplicationDaemonTaskStartupHook( void );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function resets the internal state of the timer module. It must be called
|
||||||
|
* by the application before restarting the scheduler.
|
||||||
|
*/
|
||||||
|
void vTimerResetState( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
46
list.c
46
list.c
|
@ -37,11 +37,10 @@
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
/* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified
|
/* The MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be
|
||||||
* because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be
|
|
||||||
* defined for the header files above, but not in this file, in order to
|
* defined for the header files above, but not in this file, in order to
|
||||||
* generate the correct privileged Vs unprivileged linkage and placement. */
|
* generate the correct privileged Vs unprivileged linkage and placement. */
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021. */
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* PUBLIC LIST API documented in list.h
|
* PUBLIC LIST API documented in list.h
|
||||||
|
@ -49,10 +48,12 @@
|
||||||
|
|
||||||
void vListInitialise( List_t * const pxList )
|
void vListInitialise( List_t * const pxList )
|
||||||
{
|
{
|
||||||
|
traceENTER_vListInitialise( pxList );
|
||||||
|
|
||||||
/* The list structure contains a list item which is used to mark the
|
/* The list structure contains a list item which is used to mark the
|
||||||
* end of the list. To initialise the list the list end is inserted
|
* end of the list. To initialise the list the list end is inserted
|
||||||
* as the only list entry. */
|
* as the only list entry. */
|
||||||
pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd );
|
||||||
|
|
||||||
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( &( pxList->xListEnd ) );
|
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( &( pxList->xListEnd ) );
|
||||||
|
|
||||||
|
@ -62,8 +63,8 @@ void vListInitialise( List_t * const pxList )
|
||||||
|
|
||||||
/* The list end next and previous pointers point to itself so we know
|
/* The list end next and previous pointers point to itself so we know
|
||||||
* when the list is empty. */
|
* when the list is empty. */
|
||||||
pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd );
|
||||||
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );
|
||||||
|
|
||||||
/* Initialize the remaining fields of xListEnd when it is a proper ListItem_t */
|
/* Initialize the remaining fields of xListEnd when it is a proper ListItem_t */
|
||||||
#if ( configUSE_MINI_LIST_ITEM == 0 )
|
#if ( configUSE_MINI_LIST_ITEM == 0 )
|
||||||
|
@ -80,11 +81,15 @@ void vListInitialise( List_t * const pxList )
|
||||||
* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
|
listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
|
||||||
listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
|
listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
|
||||||
|
|
||||||
|
traceRETURN_vListInitialise();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vListInitialiseItem( ListItem_t * const pxItem )
|
void vListInitialiseItem( ListItem_t * const pxItem )
|
||||||
{
|
{
|
||||||
|
traceENTER_vListInitialiseItem( pxItem );
|
||||||
|
|
||||||
/* Make sure the list item is not recorded as being on a list. */
|
/* Make sure the list item is not recorded as being on a list. */
|
||||||
pxItem->pxContainer = NULL;
|
pxItem->pxContainer = NULL;
|
||||||
|
|
||||||
|
@ -92,6 +97,8 @@ void vListInitialiseItem( ListItem_t * const pxItem )
|
||||||
* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||||
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
|
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
|
||||||
listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
|
listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
|
||||||
|
|
||||||
|
traceRETURN_vListInitialiseItem();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -100,6 +107,8 @@ void vListInsertEnd( List_t * const pxList,
|
||||||
{
|
{
|
||||||
ListItem_t * const pxIndex = pxList->pxIndex;
|
ListItem_t * const pxIndex = pxList->pxIndex;
|
||||||
|
|
||||||
|
traceENTER_vListInsertEnd( pxList, pxNewListItem );
|
||||||
|
|
||||||
/* Only effective when configASSERT() is also defined, these tests may catch
|
/* Only effective when configASSERT() is also defined, these tests may catch
|
||||||
* the list data structures being overwritten in memory. They will not catch
|
* the list data structures being overwritten in memory. They will not catch
|
||||||
* data errors caused by incorrect configuration or use of FreeRTOS. */
|
* data errors caused by incorrect configuration or use of FreeRTOS. */
|
||||||
|
@ -121,7 +130,9 @@ void vListInsertEnd( List_t * const pxList,
|
||||||
/* Remember which list the item is in. */
|
/* Remember which list the item is in. */
|
||||||
pxNewListItem->pxContainer = pxList;
|
pxNewListItem->pxContainer = pxList;
|
||||||
|
|
||||||
( pxList->uxNumberOfItems )++;
|
( pxList->uxNumberOfItems ) = ( UBaseType_t ) ( pxList->uxNumberOfItems + 1U );
|
||||||
|
|
||||||
|
traceRETURN_vListInsertEnd();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -131,6 +142,8 @@ void vListInsert( List_t * const pxList,
|
||||||
ListItem_t * pxIterator;
|
ListItem_t * pxIterator;
|
||||||
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
||||||
|
|
||||||
|
traceENTER_vListInsert( pxList, pxNewListItem );
|
||||||
|
|
||||||
/* Only effective when configASSERT() is also defined, these tests may catch
|
/* Only effective when configASSERT() is also defined, these tests may catch
|
||||||
* the list data structures being overwritten in memory. They will not catch
|
* the list data structures being overwritten in memory. They will not catch
|
||||||
* data errors caused by incorrect configuration or use of FreeRTOS. */
|
* data errors caused by incorrect configuration or use of FreeRTOS. */
|
||||||
|
@ -153,7 +166,7 @@ void vListInsert( List_t * const pxList,
|
||||||
{
|
{
|
||||||
/* *** NOTE ***********************************************************
|
/* *** NOTE ***********************************************************
|
||||||
* If you find your application is crashing here then likely causes are
|
* If you find your application is crashing here then likely causes are
|
||||||
* listed below. In addition see https://www.FreeRTOS.org/FAQHelp.html for
|
* listed below. In addition see https://www.freertos.org/Why-FreeRTOS/FAQs for
|
||||||
* more tips, and ensure configASSERT() is defined!
|
* more tips, and ensure configASSERT() is defined!
|
||||||
* https://www.FreeRTOS.org/a00110.html#configASSERT
|
* https://www.FreeRTOS.org/a00110.html#configASSERT
|
||||||
*
|
*
|
||||||
|
@ -176,10 +189,12 @@ void vListInsert( List_t * const pxList,
|
||||||
* configMAX_SYSCALL_INTERRUPT_PRIORITY.
|
* configMAX_SYSCALL_INTERRUPT_PRIORITY.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. *//*lint !e440 The iterator moves to a different value, not xValueOfInsertion. */
|
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
|
||||||
{
|
{
|
||||||
/* There is nothing to do here, just iterating to the wanted
|
/* There is nothing to do here, just iterating to the wanted
|
||||||
* insertion position. */
|
* insertion position.
|
||||||
|
* IF YOU FIND YOUR CODE STUCK HERE, SEE THE NOTE JUST ABOVE.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,16 +207,21 @@ void vListInsert( List_t * const pxList,
|
||||||
* item later. */
|
* item later. */
|
||||||
pxNewListItem->pxContainer = pxList;
|
pxNewListItem->pxContainer = pxList;
|
||||||
|
|
||||||
( pxList->uxNumberOfItems )++;
|
( pxList->uxNumberOfItems ) = ( UBaseType_t ) ( pxList->uxNumberOfItems + 1U );
|
||||||
|
|
||||||
|
traceRETURN_vListInsert();
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
|
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
|
||||||
{
|
{
|
||||||
/* The list item knows which list it is in. Obtain the list from the list
|
/* The list item knows which list it is in. Obtain the list from the list
|
||||||
* item. */
|
* item. */
|
||||||
List_t * const pxList = pxItemToRemove->pxContainer;
|
List_t * const pxList = pxItemToRemove->pxContainer;
|
||||||
|
|
||||||
|
traceENTER_uxListRemove( pxItemToRemove );
|
||||||
|
|
||||||
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
|
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
|
||||||
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
|
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
|
||||||
|
|
||||||
|
@ -219,7 +239,9 @@ UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
|
||||||
}
|
}
|
||||||
|
|
||||||
pxItemToRemove->pxContainer = NULL;
|
pxItemToRemove->pxContainer = NULL;
|
||||||
( pxList->uxNumberOfItems )--;
|
( pxList->uxNumberOfItems ) = ( UBaseType_t ) ( pxList->uxNumberOfItems - 1U );
|
||||||
|
|
||||||
|
traceRETURN_uxListRemove( pxList->uxNumberOfItems );
|
||||||
|
|
||||||
return pxList->uxNumberOfItems;
|
return pxList->uxNumberOfItems;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name : "FreeRTOS-Kernel"
|
name : "FreeRTOS-Kernel"
|
||||||
version: "v10.5.1"
|
version: "V11.0.1+"
|
||||||
description: "FreeRTOS Kernel."
|
description: "FreeRTOS Kernel."
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
This directory tree contains the master copy of the FreeeRTOS Armv8-M and
|
This directory tree contains the master copy of the FreeRTOS Armv8-M and
|
||||||
Armv8.1-M ports.
|
Armv8.1-M ports.
|
||||||
Do not use the files located here! These file are copied into separate
|
Do not use the files located here! These file are copied into separate
|
||||||
FreeRTOS/Source/portable/[compiler]/ARM_CM[23|33|55|85]_NNN directories prior to each
|
FreeRTOS/Source/portable/[compiler]/ARM_CM[23|33|55|85]_NNN directories prior to each
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -36,6 +36,9 @@
|
||||||
/* Portasm includes. */
|
/* Portasm includes. */
|
||||||
#include "portasm.h"
|
#include "portasm.h"
|
||||||
|
|
||||||
|
/* System call numbers includes. */
|
||||||
|
#include "mpu_syscall_numbers.h"
|
||||||
|
|
||||||
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the
|
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the
|
||||||
* header files. */
|
* header files. */
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
@ -53,11 +56,11 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" program_mpu_first_task: \n"
|
" program_mpu_first_task: \n"
|
||||||
" ldr r3, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" \n"
|
" \n"
|
||||||
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
||||||
" ldr r1, xMPUCTRLConst2 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" movs r3, #1 \n" /* r3 = 1. */
|
" movs r3, #1 \n" /* r3 = 1. */
|
||||||
" bics r2, r3 \n" /* r2 = r2 & ~r3 i.e. Clear the bit 0 in r2. */
|
" bics r2, r3 \n" /* r2 = r2 & ~r3 i.e. Clear the bit 0 in r2. */
|
||||||
|
@ -65,34 +68,34 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
||||||
" ldr r2, xMAIR0Const2 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
" ldr r2, =0xe000edc0 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
||||||
" str r1, [r2] \n" /* Program MAIR0. */
|
" str r1, [r2] \n" /* Program MAIR0. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
||||||
" ldr r1, xRNRConst2 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
" ldr r1, =0xe000ed98 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
||||||
" \n"
|
" \n"
|
||||||
" movs r3, #4 \n" /* r3 = 4. */
|
" movs r3, #4 \n" /* r3 = 4. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 4. */
|
" str r3, [r1] \n" /* Program RNR = 4. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read first set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read first set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write first set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write first set of RBAR/RLAR registers. */
|
||||||
" movs r3, #5 \n" /* r3 = 5. */
|
" movs r3, #5 \n" /* r3 = 5. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 5. */
|
" str r3, [r1] \n" /* Program RNR = 5. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read second set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read second set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write second set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write second set of RBAR/RLAR registers. */
|
||||||
" movs r3, #6 \n" /* r3 = 6. */
|
" movs r3, #6 \n" /* r3 = 6. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 6. */
|
" str r3, [r1] \n" /* Program RNR = 6. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read third set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read third set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write third set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write third set of RBAR/RLAR registers. */
|
||||||
" movs r3, #7 \n" /* r3 = 6. */
|
" movs r3, #7 \n" /* r3 = 6. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 7. */
|
" str r3, [r1] \n" /* Program RNR = 7. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read fourth set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read fourth set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write fourth set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write fourth set of RBAR/RLAR registers. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r1, xMPUCTRLConst2 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" movs r3, #1 \n" /* r3 = 1. */
|
" movs r3, #1 \n" /* r3 = 1. */
|
||||||
" orrs r2, r3 \n" /* r2 = r2 | r3 i.e. Set the bit 0 in r2. */
|
" orrs r2, r3 \n" /* r2 = r2 | r3 i.e. Set the bit 0 in r2. */
|
||||||
|
@ -100,7 +103,7 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" dsb \n" /* Force memory writes before continuing. */
|
" dsb \n" /* Force memory writes before continuing. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_context_first_task: \n"
|
" restore_context_first_task: \n"
|
||||||
" ldr r3, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* r1 = pxCurrentTCB.*/
|
" ldr r1, [r3] \n" /* r1 = pxCurrentTCB.*/
|
||||||
" ldr r2, [r1] \n" /* r2 = Location of saved context in TCB. */
|
" ldr r2, [r1] \n" /* r2 = Location of saved context in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -109,10 +112,9 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" ldmia r2!, {r0, r3-r6} \n" /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, r6 = LR. */
|
" ldmia r2!, {r0, r3-r6} \n" /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, r6 = LR. */
|
||||||
" subs r2, #20 \n"
|
" subs r2, #20 \n"
|
||||||
" msr psp, r3 \n"
|
" msr psp, r3 \n"
|
||||||
" msr psplim, r4 \n"
|
|
||||||
" msr control, r5 \n"
|
" msr control, r5 \n"
|
||||||
" mov lr, r6 \n"
|
" mov lr, r6 \n"
|
||||||
" ldr r4, xSecureContextConst2 \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r4, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" str r0, [r4] \n" /* Restore xSecureContext. */
|
" str r0, [r4] \n" /* Restore xSecureContext. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_general_regs_first_task: \n"
|
" restore_general_regs_first_task: \n"
|
||||||
|
@ -134,14 +136,6 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" restore_context_done_first_task: \n"
|
" restore_context_done_first_task: \n"
|
||||||
" str r2, [r1] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
" str r2, [r1] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
" pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
|
||||||
" xSecureContextConst2: .word xSecureContext \n"
|
|
||||||
" xMPUCTRLConst2: .word 0xe000ed94 \n"
|
|
||||||
" xMAIR0Const2: .word 0xe000edc0 \n"
|
|
||||||
" xRNRConst2: .word 0xe000ed98 \n"
|
|
||||||
" xRBARConst2: .word 0xe000ed9c \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,24 +147,19 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst2 \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r3, [r2] \n" /* Read pxCurrentTCB. */
|
" ldr r3, [r2] \n" /* Read pxCurrentTCB. */
|
||||||
" ldr r0, [r3] \n" /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
" ldr r0, [r3] \n" /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldm r0!, {r1-r3} \n" /* Read from stack - r1 = xSecureContext, r2 = PSPLIM and r3 = EXC_RETURN. */
|
" ldm r0!, {r1-r3} \n" /* Read from stack - r1 = xSecureContext, r2 = PSPLIM and r3 = EXC_RETURN. */
|
||||||
" ldr r4, xSecureContextConst2 \n"
|
" ldr r4, =xSecureContext \n"
|
||||||
" str r1, [r4] \n" /* Set xSecureContext to this task's value for the same. */
|
" str r1, [r4] \n" /* Set xSecureContext to this task's value for the same. */
|
||||||
" msr psplim, r2 \n"/* Set this task's PSPLIM value. */
|
|
||||||
" movs r1, #2 \n" /* r1 = 2. */
|
" movs r1, #2 \n" /* r1 = 2. */
|
||||||
" msr CONTROL, r1 \n" /* Switch to use PSP in the thread mode. */
|
" msr CONTROL, r1 \n" /* Switch to use PSP in the thread mode. */
|
||||||
" adds r0, #32 \n" /* Discard everything up to r0. */
|
" adds r0, #32 \n" /* Discard everything up to r0. */
|
||||||
" msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
|
" msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
|
||||||
" isb \n"
|
" isb \n"
|
||||||
" bx r3 \n" /* Finally, branch to EXC_RETURN. */
|
" bx r3 \n" /* Finally, branch to EXC_RETURN. */
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
|
||||||
"xSecureContextConst2: .word xSecureContext \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,8 +181,6 @@ BaseType_t xIsPrivileged( void ) /* __attribute__ (( naked )) */
|
||||||
" running_privileged: \n"
|
" running_privileged: \n"
|
||||||
" movs r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
|
" movs r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
|
||||||
" bx lr \n" /* Return. */
|
" bx lr \n" /* Return. */
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
::: "r0", "r1", "memory"
|
::: "r0", "r1", "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -237,7 +224,7 @@ void vStartFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r0, xVTORConst \n"/* Use the NVIC offset register to locate the stack. */
|
" ldr r0, =0xe000ed08 \n" /* Use the NVIC offset register to locate the stack. */
|
||||||
" ldr r0, [r0] \n" /* Read the VTOR register which gives the address of vector table. */
|
" ldr r0, [r0] \n" /* Read the VTOR register which gives the address of vector table. */
|
||||||
" ldr r0, [r0] \n" /* The first entry in vector table is stack pointer. */
|
" ldr r0, [r0] \n" /* The first entry in vector table is stack pointer. */
|
||||||
" msr msp, r0 \n" /* Set the MSP back to the start of the stack. */
|
" msr msp, r0 \n" /* Set the MSP back to the start of the stack. */
|
||||||
|
@ -246,9 +233,6 @@ void vStartFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" isb \n"
|
" isb \n"
|
||||||
" svc %0 \n" /* System call to start the first task. */
|
" svc %0 \n" /* System call to start the first task. */
|
||||||
" nop \n"
|
" nop \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"xVTORConst: .word 0xe000ed08 \n"
|
|
||||||
::"i" ( portSVC_START_SCHEDULER ) : "memory"
|
::"i" ( portSVC_START_SCHEDULER ) : "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -291,9 +275,9 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" .extern SecureContext_SaveContext \n"
|
" .extern SecureContext_SaveContext \n"
|
||||||
" .extern SecureContext_LoadContext \n"
|
" .extern SecureContext_LoadContext \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r3, xSecureContextConst \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r3, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" ldr r0, [r3] \n" /* Read xSecureContext - Value of xSecureContext must be in r0 as it is used as a parameter later. */
|
" ldr r0, [r3] \n" /* Read xSecureContext - Value of xSecureContext must be in r0 as it is used as a parameter later. */
|
||||||
" ldr r3, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB - Value of pxCurrentTCB must be in r1 as it is used as a parameter later.*/
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB - Value of pxCurrentTCB must be in r1 as it is used as a parameter later.*/
|
||||||
" ldr r2, [r1] \n" /* r2 = Location in TCB where the context should be saved. */
|
" ldr r2, [r1] \n" /* r2 = Location in TCB where the context should be saved. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -324,7 +308,7 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" \n"
|
" \n"
|
||||||
" save_special_regs: \n"
|
" save_special_regs: \n"
|
||||||
" mrs r3, psp \n" /* r3 = PSP. */
|
" mrs r3, psp \n" /* r3 = PSP. */
|
||||||
" mrs r4, psplim \n" /* r4 = PSPLIM. */
|
" movs r4, #0 \n" /* r4 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
" mrs r5, control \n" /* r5 = CONTROL. */
|
" mrs r5, control \n" /* r5 = CONTROL. */
|
||||||
" mov r6, lr \n" /* r6 = LR. */
|
" mov r6, lr \n" /* r6 = LR. */
|
||||||
" stmia r2!, {r0, r3-r6} \n" /* Store xSecureContext, original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
" stmia r2!, {r0, r3-r6} \n" /* Store xSecureContext, original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
||||||
|
@ -336,11 +320,11 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" cpsie i \n"
|
" cpsie i \n"
|
||||||
" \n"
|
" \n"
|
||||||
" program_mpu: \n"
|
" program_mpu: \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" \n"
|
" \n"
|
||||||
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
||||||
" ldr r1, xMPUCTRLConst \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" movs r3, #1 \n" /* r3 = 1. */
|
" movs r3, #1 \n" /* r3 = 1. */
|
||||||
" bics r2, r3 \n" /* r2 = r2 & ~r3 i.e. Clear the bit 0 in r2. */
|
" bics r2, r3 \n" /* r2 = r2 & ~r3 i.e. Clear the bit 0 in r2. */
|
||||||
|
@ -348,34 +332,34 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
||||||
" ldr r2, xMAIR0Const \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
" ldr r2, =0xe000edc0 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
||||||
" str r1, [r2] \n" /* Program MAIR0. */
|
" str r1, [r2] \n" /* Program MAIR0. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
||||||
" ldr r1, xRNRConst \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
" ldr r1, =0xe000ed98 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
||||||
" \n"
|
" \n"
|
||||||
" movs r3, #4 \n" /* r3 = 4. */
|
" movs r3, #4 \n" /* r3 = 4. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 4. */
|
" str r3, [r1] \n" /* Program RNR = 4. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read first set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read first set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write first set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write first set of RBAR/RLAR registers. */
|
||||||
" movs r3, #5 \n" /* r3 = 5. */
|
" movs r3, #5 \n" /* r3 = 5. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 5. */
|
" str r3, [r1] \n" /* Program RNR = 5. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read second set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read second set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write second set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write second set of RBAR/RLAR registers. */
|
||||||
" movs r3, #6 \n" /* r3 = 6. */
|
" movs r3, #6 \n" /* r3 = 6. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 6. */
|
" str r3, [r1] \n" /* Program RNR = 6. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read third set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read third set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write third set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write third set of RBAR/RLAR registers. */
|
||||||
" movs r3, #7 \n" /* r3 = 6. */
|
" movs r3, #7 \n" /* r3 = 6. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 7. */
|
" str r3, [r1] \n" /* Program RNR = 7. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read fourth set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read fourth set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write fourth set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write fourth set of RBAR/RLAR registers. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r1, xMPUCTRLConst \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" movs r3, #1 \n" /* r3 = 1. */
|
" movs r3, #1 \n" /* r3 = 1. */
|
||||||
" orrs r2, r3 \n" /* r2 = r2 | r3 i.e. Set the bit 0 in r2. */
|
" orrs r2, r3 \n" /* r2 = r2 | r3 i.e. Set the bit 0 in r2. */
|
||||||
|
@ -383,7 +367,7 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" dsb \n" /* Force memory writes before continuing. */
|
" dsb \n" /* Force memory writes before continuing. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_context: \n"
|
" restore_context: \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* r1 = pxCurrentTCB.*/
|
" ldr r1, [r3] \n" /* r1 = pxCurrentTCB.*/
|
||||||
" ldr r2, [r1] \n" /* r2 = Location of saved context in TCB. */
|
" ldr r2, [r1] \n" /* r2 = Location of saved context in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -392,10 +376,9 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" ldmia r2!, {r0, r3-r6} \n" /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, r6 = LR. */
|
" ldmia r2!, {r0, r3-r6} \n" /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, r6 = LR. */
|
||||||
" subs r2, #20 \n"
|
" subs r2, #20 \n"
|
||||||
" msr psp, r3 \n"
|
" msr psp, r3 \n"
|
||||||
" msr psplim, r4 \n"
|
|
||||||
" msr control, r5 \n"
|
" msr control, r5 \n"
|
||||||
" mov lr, r6 \n"
|
" mov lr, r6 \n"
|
||||||
" ldr r4, xSecureContextConst \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r4, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" str r0, [r4] \n" /* Restore xSecureContext. */
|
" str r0, [r4] \n" /* Restore xSecureContext. */
|
||||||
" cbz r0, restore_ns_context \n" /* No secure context to restore. */
|
" cbz r0, restore_ns_context \n" /* No secure context to restore. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -429,14 +412,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" restore_context_done: \n"
|
" restore_context_done: \n"
|
||||||
" str r2, [r1] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
" str r2, [r1] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
" pxCurrentTCBConst: .word pxCurrentTCB \n"
|
|
||||||
" xSecureContextConst: .word xSecureContext \n"
|
|
||||||
" xMPUCTRLConst: .word 0xe000ed94 \n"
|
|
||||||
" xMAIR0Const: .word 0xe000edc0 \n"
|
|
||||||
" xRNRConst: .word 0xe000ed98 \n"
|
|
||||||
" xRBARConst: .word 0xe000ed9c \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,9 +425,9 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" .extern SecureContext_SaveContext \n"
|
" .extern SecureContext_SaveContext \n"
|
||||||
" .extern SecureContext_LoadContext \n"
|
" .extern SecureContext_LoadContext \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r3, xSecureContextConst \n"/* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r3, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" ldr r0, [r3] \n" /* Read xSecureContext - Value of xSecureContext must be in r0 as it is used as a parameter later. */
|
" ldr r0, [r3] \n" /* Read xSecureContext - Value of xSecureContext must be in r0 as it is used as a parameter later. */
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB - Value of pxCurrentTCB must be in r1 as it is used as a parameter later.*/
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB - Value of pxCurrentTCB must be in r1 as it is used as a parameter later.*/
|
||||||
" mrs r2, psp \n" /* Read PSP in r2. */
|
" mrs r2, psp \n" /* Read PSP in r2. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -463,21 +438,21 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" mov lr, r3 \n" /* LR = r3. */
|
" mov lr, r3 \n" /* LR = r3. */
|
||||||
" lsls r1, r3, #25 \n" /* r1 = r3 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
" lsls r1, r3, #25 \n" /* r1 = r3 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
||||||
" bpl save_ns_context \n" /* bpl - branch if positive or zero. If r1 >= 0 ==> Bit[6] in EXC_RETURN is 0 i.e. non-secure stack was used. */
|
" bpl save_ns_context \n" /* bpl - branch if positive or zero. If r1 >= 0 ==> Bit[6] in EXC_RETURN is 0 i.e. non-secure stack was used. */
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
||||||
" subs r2, r2, #12 \n" /* Make space for xSecureContext, PSPLIM and LR on the stack. */
|
" subs r2, r2, #12 \n" /* Make space for xSecureContext, PSPLIM and LR on the stack. */
|
||||||
" str r2, [r1] \n" /* Save the new top of stack in TCB. */
|
" str r2, [r1] \n" /* Save the new top of stack in TCB. */
|
||||||
" mrs r1, psplim \n"/* r1 = PSPLIM. */
|
" movs r1, #0 \n" /* r1 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
" mov r3, lr \n" /* r3 = LR/EXC_RETURN. */
|
" mov r3, lr \n" /* r3 = LR/EXC_RETURN. */
|
||||||
" stmia r2!, {r0, r1, r3} \n" /* Store xSecureContext, PSPLIM and LR on the stack. */
|
" stmia r2!, {r0, r1, r3} \n" /* Store xSecureContext, PSPLIM and LR on the stack. */
|
||||||
" b select_next_task \n"
|
" b select_next_task \n"
|
||||||
" \n"
|
" \n"
|
||||||
" save_ns_context: \n"
|
" save_ns_context: \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
||||||
" subs r2, r2, #44 \n" /* Make space for xSecureContext, PSPLIM, LR and the remaining registers on the stack. */
|
" subs r2, r2, #44 \n" /* Make space for xSecureContext, PSPLIM, LR and the remaining registers on the stack. */
|
||||||
" str r2, [r1] \n" /* Save the new top of stack in TCB. */
|
" str r2, [r1] \n" /* Save the new top of stack in TCB. */
|
||||||
" mrs r1, psplim \n"/* r1 = PSPLIM. */
|
" movs r1, #0 \n" /* r1 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
" mov r3, lr \n" /* r3 = LR/EXC_RETURN. */
|
" mov r3, lr \n" /* r3 = LR/EXC_RETURN. */
|
||||||
" stmia r2!, {r0, r1, r3-r7} \n" /* Store xSecureContext, PSPLIM, LR and the low registers that are not saved automatically. */
|
" stmia r2!, {r0, r1, r3-r7} \n" /* Store xSecureContext, PSPLIM, LR and the low registers that are not saved automatically. */
|
||||||
" mov r4, r8 \n" /* r4 = r8. */
|
" mov r4, r8 \n" /* r4 = r8. */
|
||||||
|
@ -491,17 +466,16 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" bl vTaskSwitchContext \n"
|
" bl vTaskSwitchContext \n"
|
||||||
" cpsie i \n"
|
" cpsie i \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
||||||
" ldr r2, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r2 now points to the top of stack. */
|
" ldr r2, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r2 now points to the top of stack. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldmia r2!, {r0, r1, r4} \n" /* Read from stack - r0 = xSecureContext, r1 = PSPLIM and r4 = LR. */
|
" ldmia r2!, {r0, r1, r4} \n" /* Read from stack - r0 = xSecureContext, r1 = PSPLIM and r4 = LR. */
|
||||||
" msr psplim, r1 \n"/* Restore the PSPLIM register value for the task. */
|
|
||||||
" mov lr, r4 \n" /* LR = r4. */
|
" mov lr, r4 \n" /* LR = r4. */
|
||||||
" ldr r3, xSecureContextConst \n"/* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r3, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" str r0, [r3] \n" /* Restore the task's xSecureContext. */
|
" str r0, [r3] \n" /* Restore the task's xSecureContext. */
|
||||||
" cbz r0, restore_ns_context \n" /* If there is no secure context for the task, restore the non-secure context. */
|
" cbz r0, restore_ns_context \n" /* If there is no secure context for the task, restore the non-secure context. */
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
||||||
" push {r2, r4} \n"
|
" push {r2, r4} \n"
|
||||||
" bl SecureContext_LoadContext \n" /* Restore the secure context. Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
" bl SecureContext_LoadContext \n" /* Restore the secure context. Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
||||||
|
@ -523,10 +497,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" subs r2, r2, #32 \n" /* Go back to the low registers. */
|
" subs r2, r2, #32 \n" /* Go back to the low registers. */
|
||||||
" ldmia r2!, {r4-r7} \n" /* Restore the low registers that are not automatically restored. */
|
" ldmia r2!, {r4-r7} \n" /* Restore the low registers that are not automatically restored. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"pxCurrentTCBConst: .word pxCurrentTCB \n"
|
|
||||||
"xSecureContextConst: .word xSecureContext \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +512,6 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
".syntax unified \n"
|
".syntax unified \n"
|
||||||
".extern vPortSVCHandler_C \n"
|
".extern vPortSVCHandler_C \n"
|
||||||
".extern vSystemCallEnter \n"
|
".extern vSystemCallEnter \n"
|
||||||
".extern vSystemCallEnter_1 \n"
|
|
||||||
".extern vSystemCallExit \n"
|
".extern vSystemCallExit \n"
|
||||||
" \n"
|
" \n"
|
||||||
"movs r0, #4 \n"
|
"movs r0, #4 \n"
|
||||||
|
@ -557,26 +526,22 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" b route_svc \n"
|
" b route_svc \n"
|
||||||
" \n"
|
" \n"
|
||||||
"route_svc: \n"
|
"route_svc: \n"
|
||||||
" ldr r2, [r0, #24] \n"
|
" ldr r3, [r0, #24] \n"
|
||||||
" subs r2, #2 \n"
|
" subs r3, #2 \n"
|
||||||
" ldrb r3, [r2, #0] \n"
|
" ldrb r2, [r3, #0] \n"
|
||||||
" cmp r3, %0 \n"
|
" cmp r2, %0 \n"
|
||||||
" beq system_call_enter \n"
|
" blt system_call_enter \n"
|
||||||
" cmp r3, %1 \n"
|
" cmp r2, %1 \n"
|
||||||
" beq system_call_enter_1 \n"
|
|
||||||
" cmp r3, %2 \n"
|
|
||||||
" beq system_call_exit \n"
|
" beq system_call_exit \n"
|
||||||
" b vPortSVCHandler_C \n"
|
" b vPortSVCHandler_C \n"
|
||||||
" \n"
|
" \n"
|
||||||
"system_call_enter: \n"
|
"system_call_enter: \n"
|
||||||
" b vSystemCallEnter \n"
|
" b vSystemCallEnter \n"
|
||||||
"system_call_enter_1: \n"
|
|
||||||
" b vSystemCallEnter_1 \n"
|
|
||||||
"system_call_exit: \n"
|
"system_call_exit: \n"
|
||||||
" b vSystemCallExit \n"
|
" b vSystemCallExit \n"
|
||||||
" \n"
|
" \n"
|
||||||
: /* No outputs. */
|
: /* No outputs. */
|
||||||
:"i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT )
|
: "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT )
|
||||||
: "r0", "r1", "r2", "r3", "memory"
|
: "r0", "r1", "r2", "r3", "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -594,15 +559,12 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" tst r0, r1 \n"
|
" tst r0, r1 \n"
|
||||||
" beq stacking_used_msp \n"
|
" beq stacking_used_msp \n"
|
||||||
" mrs r0, psp \n"
|
" mrs r0, psp \n"
|
||||||
" ldr r2, svchandler_address_const \n"
|
" ldr r2, =vPortSVCHandler_C \n"
|
||||||
" bx r2 \n"
|
" bx r2 \n"
|
||||||
" stacking_used_msp: \n"
|
" stacking_used_msp: \n"
|
||||||
" mrs r0, msp \n"
|
" mrs r0, msp \n"
|
||||||
" ldr r2, svchandler_address_const \n"
|
" ldr r2, =vPortSVCHandler_C \n"
|
||||||
" bx r2 \n"
|
" bx r2 \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"svchandler_address_const: .word vPortSVCHandler_C \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M23"
|
#define portARCH_NAME "Cortex-M23"
|
||||||
#define portHAS_BASEPRI 0
|
#define portHAS_ARMV8M_MAIN_EXTENSION 0
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -60,6 +61,12 @@
|
||||||
#if ( configTOTAL_MPU_REGIONS == 16 )
|
#if ( configTOTAL_MPU_REGIONS == 16 )
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
#error 16 MPU regions are not yet supported for this port.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configENABLE_MVE
|
||||||
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,6 +36,9 @@
|
||||||
/* Portasm includes. */
|
/* Portasm includes. */
|
||||||
#include "portasm.h"
|
#include "portasm.h"
|
||||||
|
|
||||||
|
/* System call numbers includes. */
|
||||||
|
#include "mpu_syscall_numbers.h"
|
||||||
|
|
||||||
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the
|
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the
|
||||||
* header files. */
|
* header files. */
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
@ -53,11 +56,11 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" program_mpu_first_task: \n"
|
" program_mpu_first_task: \n"
|
||||||
" ldr r3, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" \n"
|
" \n"
|
||||||
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
||||||
" ldr r1, xMPUCTRLConst2 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" movs r3, #1 \n" /* r3 = 1. */
|
" movs r3, #1 \n" /* r3 = 1. */
|
||||||
" bics r2, r3 \n" /* r2 = r2 & ~r3 i.e. Clear the bit 0 in r2. */
|
" bics r2, r3 \n" /* r2 = r2 & ~r3 i.e. Clear the bit 0 in r2. */
|
||||||
|
@ -65,34 +68,34 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
||||||
" ldr r2, xMAIR0Const2 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
" ldr r2, =0xe000edc0 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
||||||
" str r1, [r2] \n" /* Program MAIR0. */
|
" str r1, [r2] \n" /* Program MAIR0. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
||||||
" ldr r1, xRNRConst2 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
" ldr r1, =0xe000ed98 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
||||||
" \n"
|
" \n"
|
||||||
" movs r3, #4 \n" /* r3 = 4. */
|
" movs r3, #4 \n" /* r3 = 4. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 4. */
|
" str r3, [r1] \n" /* Program RNR = 4. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read first set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read first set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write first set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write first set of RBAR/RLAR registers. */
|
||||||
" movs r3, #5 \n" /* r3 = 5. */
|
" movs r3, #5 \n" /* r3 = 5. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 5. */
|
" str r3, [r1] \n" /* Program RNR = 5. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read second set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read second set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write second set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write second set of RBAR/RLAR registers. */
|
||||||
" movs r3, #6 \n" /* r3 = 6. */
|
" movs r3, #6 \n" /* r3 = 6. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 6. */
|
" str r3, [r1] \n" /* Program RNR = 6. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read third set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read third set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write third set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write third set of RBAR/RLAR registers. */
|
||||||
" movs r3, #7 \n" /* r3 = 6. */
|
" movs r3, #7 \n" /* r3 = 6. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 7. */
|
" str r3, [r1] \n" /* Program RNR = 7. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read fourth set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read fourth set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write fourth set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write fourth set of RBAR/RLAR registers. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r1, xMPUCTRLConst2 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" movs r3, #1 \n" /* r3 = 1. */
|
" movs r3, #1 \n" /* r3 = 1. */
|
||||||
" orrs r2, r3 \n" /* r2 = r2 | r3 i.e. Set the bit 0 in r2. */
|
" orrs r2, r3 \n" /* r2 = r2 | r3 i.e. Set the bit 0 in r2. */
|
||||||
|
@ -100,7 +103,7 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" dsb \n" /* Force memory writes before continuing. */
|
" dsb \n" /* Force memory writes before continuing. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_context_first_task: \n"
|
" restore_context_first_task: \n"
|
||||||
" ldr r2, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" ldr r1, [r0] \n" /* r1 = Location of saved context in TCB. */
|
" ldr r1, [r0] \n" /* r1 = Location of saved context in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -109,7 +112,9 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" ldmia r1!, {r2-r5} \n" /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, r5 = LR. */
|
" ldmia r1!, {r2-r5} \n" /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, r5 = LR. */
|
||||||
" subs r1, #16 \n"
|
" subs r1, #16 \n"
|
||||||
" msr psp, r2 \n"
|
" msr psp, r2 \n"
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
" msr psplim, r3 \n"
|
" msr psplim, r3 \n"
|
||||||
|
#endif
|
||||||
" msr control, r4 \n"
|
" msr control, r4 \n"
|
||||||
" mov lr, r5 \n"
|
" mov lr, r5 \n"
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -132,13 +137,6 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" restore_context_done_first_task: \n"
|
" restore_context_done_first_task: \n"
|
||||||
" str r1, [r0] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
" str r1, [r0] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
" pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
|
||||||
" xMPUCTRLConst2: .word 0xe000ed94 \n"
|
|
||||||
" xMAIR0Const2: .word 0xe000edc0 \n"
|
|
||||||
" xRNRConst2: .word 0xe000ed98 \n"
|
|
||||||
" xRBARConst2: .word 0xe000ed9c \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,21 +148,20 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst2 \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
||||||
" ldr r0, [r1] \n" /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
" ldr r0, [r1] \n" /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldm r0!, {r1-r2} \n" /* Read from stack - r1 = PSPLIM and r2 = EXC_RETURN. */
|
" ldm r0!, {r1-r2} \n" /* Read from stack - r1 = PSPLIM and r2 = EXC_RETURN. */
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
" msr psplim, r1 \n" /* Set this task's PSPLIM value. */
|
" msr psplim, r1 \n" /* Set this task's PSPLIM value. */
|
||||||
|
#endif
|
||||||
" movs r1, #2 \n" /* r1 = 2. */
|
" movs r1, #2 \n" /* r1 = 2. */
|
||||||
" msr CONTROL, r1 \n" /* Switch to use PSP in the thread mode. */
|
" msr CONTROL, r1 \n" /* Switch to use PSP in the thread mode. */
|
||||||
" adds r0, #32 \n" /* Discard everything up to r0. */
|
" adds r0, #32 \n" /* Discard everything up to r0. */
|
||||||
" msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
|
" msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
|
||||||
" isb \n"
|
" isb \n"
|
||||||
" bx r2 \n" /* Finally, branch to EXC_RETURN. */
|
" bx r2 \n" /* Finally, branch to EXC_RETURN. */
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,8 +183,6 @@ BaseType_t xIsPrivileged( void ) /* __attribute__ (( naked )) */
|
||||||
" running_privileged: \n"
|
" running_privileged: \n"
|
||||||
" movs r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
|
" movs r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
|
||||||
" bx lr \n" /* Return. */
|
" bx lr \n" /* Return. */
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
::: "r0", "r1", "memory"
|
::: "r0", "r1", "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -231,7 +226,7 @@ void vStartFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r0, xVTORConst \n"/* Use the NVIC offset register to locate the stack. */
|
" ldr r0, =0xe000ed08 \n" /* Use the NVIC offset register to locate the stack. */
|
||||||
" ldr r0, [r0] \n" /* Read the VTOR register which gives the address of vector table. */
|
" ldr r0, [r0] \n" /* Read the VTOR register which gives the address of vector table. */
|
||||||
" ldr r0, [r0] \n" /* The first entry in vector table is stack pointer. */
|
" ldr r0, [r0] \n" /* The first entry in vector table is stack pointer. */
|
||||||
" msr msp, r0 \n" /* Set the MSP back to the start of the stack. */
|
" msr msp, r0 \n" /* Set the MSP back to the start of the stack. */
|
||||||
|
@ -240,9 +235,6 @@ void vStartFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" isb \n"
|
" isb \n"
|
||||||
" svc %0 \n" /* System call to start the first task. */
|
" svc %0 \n" /* System call to start the first task. */
|
||||||
" nop \n"
|
" nop \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"xVTORConst: .word 0xe000ed08 \n"
|
|
||||||
::"i" ( portSVC_START_SCHEDULER ) : "memory"
|
::"i" ( portSVC_START_SCHEDULER ) : "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -283,7 +275,7 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB. */
|
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = Location in TCB where the context should be saved. */
|
" ldr r1, [r0] \n" /* r1 = Location in TCB where the context should be saved. */
|
||||||
" mrs r2, psp \n" /* r2 = PSP. */
|
" mrs r2, psp \n" /* r2 = PSP. */
|
||||||
|
@ -302,7 +294,11 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" \n"
|
" \n"
|
||||||
" save_special_regs: \n"
|
" save_special_regs: \n"
|
||||||
" mrs r2, psp \n" /* r2 = PSP. */
|
" mrs r2, psp \n" /* r2 = PSP. */
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
" mrs r3, psplim \n" /* r3 = PSPLIM. */
|
" mrs r3, psplim \n" /* r3 = PSPLIM. */
|
||||||
|
#else
|
||||||
|
" movs r3, #0 \n" /* r3 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
|
#endif
|
||||||
" mrs r4, control \n" /* r4 = CONTROL. */
|
" mrs r4, control \n" /* r4 = CONTROL. */
|
||||||
" mov r5, lr \n" /* r5 = LR. */
|
" mov r5, lr \n" /* r5 = LR. */
|
||||||
" stmia r1!, {r2-r5} \n" /* Store original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
" stmia r1!, {r2-r5} \n" /* Store original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
||||||
|
@ -314,11 +310,11 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" cpsie i \n"
|
" cpsie i \n"
|
||||||
" \n"
|
" \n"
|
||||||
" program_mpu: \n"
|
" program_mpu: \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" \n"
|
" \n"
|
||||||
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
||||||
" ldr r1, xMPUCTRLConst \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" movs r3, #1 \n" /* r3 = 1. */
|
" movs r3, #1 \n" /* r3 = 1. */
|
||||||
" bics r2, r3 \n" /* r2 = r2 & ~r3 i.e. Clear the bit 0 in r2. */
|
" bics r2, r3 \n" /* r2 = r2 & ~r3 i.e. Clear the bit 0 in r2. */
|
||||||
|
@ -326,34 +322,34 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
||||||
" ldr r2, xMAIR0Const \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
" ldr r2, =0xe000edc0 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
||||||
" str r1, [r2] \n" /* Program MAIR0. */
|
" str r1, [r2] \n" /* Program MAIR0. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
||||||
" ldr r1, xRNRConst \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
" ldr r1, =0xe000ed98 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
||||||
" \n"
|
" \n"
|
||||||
" movs r3, #4 \n" /* r3 = 4. */
|
" movs r3, #4 \n" /* r3 = 4. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 4. */
|
" str r3, [r1] \n" /* Program RNR = 4. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read first set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read first set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write first set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write first set of RBAR/RLAR registers. */
|
||||||
" movs r3, #5 \n" /* r3 = 5. */
|
" movs r3, #5 \n" /* r3 = 5. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 5. */
|
" str r3, [r1] \n" /* Program RNR = 5. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read second set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read second set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write second set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write second set of RBAR/RLAR registers. */
|
||||||
" movs r3, #6 \n" /* r3 = 6. */
|
" movs r3, #6 \n" /* r3 = 6. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 6. */
|
" str r3, [r1] \n" /* Program RNR = 6. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read third set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read third set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write third set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write third set of RBAR/RLAR registers. */
|
||||||
" movs r3, #7 \n" /* r3 = 6. */
|
" movs r3, #7 \n" /* r3 = 6. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 7. */
|
" str r3, [r1] \n" /* Program RNR = 7. */
|
||||||
" ldmia r0!, {r4-r5} \n" /* Read fourth set of RBAR/RLAR registers from TCB. */
|
" ldmia r0!, {r4-r5} \n" /* Read fourth set of RBAR/RLAR registers from TCB. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" stmia r2!, {r4-r5} \n" /* Write fourth set of RBAR/RLAR registers. */
|
" stmia r2!, {r4-r5} \n" /* Write fourth set of RBAR/RLAR registers. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r1, xMPUCTRLConst \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" movs r3, #1 \n" /* r3 = 1. */
|
" movs r3, #1 \n" /* r3 = 1. */
|
||||||
" orrs r2, r3 \n" /* r2 = r2 | r3 i.e. Set the bit 0 in r2. */
|
" orrs r2, r3 \n" /* r2 = r2 | r3 i.e. Set the bit 0 in r2. */
|
||||||
|
@ -361,7 +357,7 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" dsb \n" /* Force memory writes before continuing. */
|
" dsb \n" /* Force memory writes before continuing. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_context: \n"
|
" restore_context: \n"
|
||||||
" ldr r2, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" ldr r1, [r0] \n" /* r1 = Location of saved context in TCB. */
|
" ldr r1, [r0] \n" /* r1 = Location of saved context in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -370,7 +366,9 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" ldmia r1!, {r2-r5} \n" /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, r5 = LR. */
|
" ldmia r1!, {r2-r5} \n" /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, r5 = LR. */
|
||||||
" subs r1, #16 \n"
|
" subs r1, #16 \n"
|
||||||
" msr psp, r2 \n"
|
" msr psp, r2 \n"
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
" msr psplim, r3 \n"
|
" msr psplim, r3 \n"
|
||||||
|
#endif
|
||||||
" msr control, r4 \n"
|
" msr control, r4 \n"
|
||||||
" mov lr, r5 \n"
|
" mov lr, r5 \n"
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -393,13 +391,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" restore_context_done: \n"
|
" restore_context_done: \n"
|
||||||
" str r1, [r0] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
" str r1, [r0] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
" pxCurrentTCBConst: .word pxCurrentTCB \n"
|
|
||||||
" xMPUCTRLConst: .word 0xe000ed94 \n"
|
|
||||||
" xMAIR0Const: .word 0xe000edc0 \n"
|
|
||||||
" xRNRConst: .word 0xe000ed98 \n"
|
|
||||||
" xRBARConst: .word 0xe000ed9c \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,11 +403,15 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" mrs r0, psp \n" /* Read PSP in r0. */
|
" mrs r0, psp \n" /* Read PSP in r0. */
|
||||||
" ldr r2, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
||||||
" subs r0, r0, #40 \n" /* Make space for PSPLIM, LR and the remaining registers on the stack. */
|
" subs r0, r0, #40 \n" /* Make space for PSPLIM, LR and the remaining registers on the stack. */
|
||||||
" str r0, [r1] \n" /* Save the new top of stack in TCB. */
|
" str r0, [r1] \n" /* Save the new top of stack in TCB. */
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
" mrs r2, psplim \n" /* r2 = PSPLIM. */
|
" mrs r2, psplim \n" /* r2 = PSPLIM. */
|
||||||
|
#else
|
||||||
|
" movs r2, #0 \n" /* r2 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
|
#endif
|
||||||
" mov r3, lr \n" /* r3 = LR/EXC_RETURN. */
|
" mov r3, lr \n" /* r3 = LR/EXC_RETURN. */
|
||||||
" stmia r0!, {r2-r7} \n" /* Store on the stack - PSPLIM, LR and low registers that are not automatically saved. */
|
" stmia r0!, {r2-r7} \n" /* Store on the stack - PSPLIM, LR and low registers that are not automatically saved. */
|
||||||
" mov r4, r8 \n" /* r4 = r8. */
|
" mov r4, r8 \n" /* r4 = r8. */
|
||||||
|
@ -429,7 +424,7 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" bl vTaskSwitchContext \n"
|
" bl vTaskSwitchContext \n"
|
||||||
" cpsie i \n"
|
" cpsie i \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
||||||
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */
|
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -442,11 +437,10 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" msr psp, r0 \n" /* Remember the new top of stack for the task. */
|
" msr psp, r0 \n" /* Remember the new top of stack for the task. */
|
||||||
" subs r0, r0, #40 \n" /* Move to the starting of the saved context. */
|
" subs r0, r0, #40 \n" /* Move to the starting of the saved context. */
|
||||||
" ldmia r0!, {r2-r7} \n" /* Read from stack - r2 = PSPLIM, r3 = LR and r4-r7 restored. */
|
" ldmia r0!, {r2-r7} \n" /* Read from stack - r2 = PSPLIM, r3 = LR and r4-r7 restored. */
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
" msr psplim, r2 \n" /* Restore the PSPLIM register value for the task. */
|
" msr psplim, r2 \n" /* Restore the PSPLIM register value for the task. */
|
||||||
|
#endif
|
||||||
" bx r3 \n"
|
" bx r3 \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"pxCurrentTCBConst: .word pxCurrentTCB \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +456,6 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
".syntax unified \n"
|
".syntax unified \n"
|
||||||
".extern vPortSVCHandler_C \n"
|
".extern vPortSVCHandler_C \n"
|
||||||
".extern vSystemCallEnter \n"
|
".extern vSystemCallEnter \n"
|
||||||
".extern vSystemCallEnter_1 \n"
|
|
||||||
".extern vSystemCallExit \n"
|
".extern vSystemCallExit \n"
|
||||||
" \n"
|
" \n"
|
||||||
"movs r0, #4 \n"
|
"movs r0, #4 \n"
|
||||||
|
@ -477,26 +470,22 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" b route_svc \n"
|
" b route_svc \n"
|
||||||
" \n"
|
" \n"
|
||||||
"route_svc: \n"
|
"route_svc: \n"
|
||||||
" ldr r2, [r0, #24] \n"
|
" ldr r3, [r0, #24] \n"
|
||||||
" subs r2, #2 \n"
|
" subs r3, #2 \n"
|
||||||
" ldrb r3, [r2, #0] \n"
|
" ldrb r2, [r3, #0] \n"
|
||||||
" cmp r3, %0 \n"
|
" cmp r2, %0 \n"
|
||||||
" beq system_call_enter \n"
|
" blt system_call_enter \n"
|
||||||
" cmp r3, %1 \n"
|
" cmp r2, %1 \n"
|
||||||
" beq system_call_enter_1 \n"
|
|
||||||
" cmp r3, %2 \n"
|
|
||||||
" beq system_call_exit \n"
|
" beq system_call_exit \n"
|
||||||
" b vPortSVCHandler_C \n"
|
" b vPortSVCHandler_C \n"
|
||||||
" \n"
|
" \n"
|
||||||
"system_call_enter: \n"
|
"system_call_enter: \n"
|
||||||
" b vSystemCallEnter \n"
|
" b vSystemCallEnter \n"
|
||||||
"system_call_enter_1: \n"
|
|
||||||
" b vSystemCallEnter_1 \n"
|
|
||||||
"system_call_exit: \n"
|
"system_call_exit: \n"
|
||||||
" b vSystemCallExit \n"
|
" b vSystemCallExit \n"
|
||||||
" \n"
|
" \n"
|
||||||
: /* No outputs. */
|
: /* No outputs. */
|
||||||
:"i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT )
|
: "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT )
|
||||||
: "r0", "r1", "r2", "r3", "memory"
|
: "r0", "r1", "r2", "r3", "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -514,15 +503,12 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" tst r0, r1 \n"
|
" tst r0, r1 \n"
|
||||||
" beq stacking_used_msp \n"
|
" beq stacking_used_msp \n"
|
||||||
" mrs r0, psp \n"
|
" mrs r0, psp \n"
|
||||||
" ldr r2, svchandler_address_const \n"
|
" ldr r2, =vPortSVCHandler_C \n"
|
||||||
" bx r2 \n"
|
" bx r2 \n"
|
||||||
" stacking_used_msp: \n"
|
" stacking_used_msp: \n"
|
||||||
" mrs r0, msp \n"
|
" mrs r0, msp \n"
|
||||||
" ldr r2, svchandler_address_const \n"
|
" ldr r2, =vPortSVCHandler_C \n"
|
||||||
" bx r2 \n"
|
" bx r2 \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"svchandler_address_const: .word vPortSVCHandler_C \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M23"
|
#define portARCH_NAME "Cortex-M23"
|
||||||
#define portHAS_BASEPRI 0
|
#define portHAS_ARMV8M_MAIN_EXTENSION 0
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -60,6 +61,12 @@
|
||||||
#if ( configTOTAL_MPU_REGIONS == 16 )
|
#if ( configTOTAL_MPU_REGIONS == 16 )
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
#error 16 MPU regions are not yet supported for this port.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configENABLE_MVE
|
||||||
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
* Copyright 2024 Arm Limited and/or its affiliates
|
||||||
|
* <open-source-office@arm.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -36,6 +38,9 @@
|
||||||
/* Portasm includes. */
|
/* Portasm includes. */
|
||||||
#include "portasm.h"
|
#include "portasm.h"
|
||||||
|
|
||||||
|
/* System call numbers includes. */
|
||||||
|
#include "mpu_syscall_numbers.h"
|
||||||
|
|
||||||
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the
|
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the
|
||||||
* header files. */
|
* header files. */
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
@ -49,23 +54,23 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" program_mpu_first_task: \n"
|
" program_mpu_first_task: \n"
|
||||||
" ldr r3, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB. */
|
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
||||||
" ldr r1, xMPUCTRLConst2 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" bic r2, #1 \n" /* r2 = r2 & ~1 i.e. Clear the bit 0 in r2. */
|
" bic r2, #1 \n" /* r2 = r2 & ~1 i.e. Clear the bit 0 in r2. */
|
||||||
" str r2, [r1] \n" /* Disable MPU. */
|
" str r2, [r1] \n" /* Disable MPU. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
||||||
" ldr r2, xMAIR0Const2 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
" ldr r2, =0xe000edc0 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
||||||
" str r1, [r2] \n" /* Program MAIR0. */
|
" str r1, [r2] \n" /* Program MAIR0. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
||||||
" ldr r1, xRNRConst2 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
" ldr r1, =0xe000ed98 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" \n"
|
" \n"
|
||||||
" movs r3, #4 \n" /* r3 = 4. */
|
" movs r3, #4 \n" /* r3 = 4. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 4. */
|
" str r3, [r1] \n" /* Program RNR = 4. */
|
||||||
|
@ -83,23 +88,31 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" stmia r2, {r4-r11} \n" /* Write 4 set of RBAR/RLAR registers using alias registers. */
|
" stmia r2, {r4-r11} \n" /* Write 4 set of RBAR/RLAR registers using alias registers. */
|
||||||
#endif /* configTOTAL_MPU_REGIONS == 16 */
|
#endif /* configTOTAL_MPU_REGIONS == 16 */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r1, xMPUCTRLConst2 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" orr r2, #1 \n" /* r2 = r1 | 1 i.e. Set the bit 0 in r2. */
|
" orr r2, #1 \n" /* r2 = r1 | 1 i.e. Set the bit 0 in r2. */
|
||||||
" str r2, [r1] \n" /* Enable MPU. */
|
" str r2, [r1] \n" /* Enable MPU. */
|
||||||
" dsb \n" /* Force memory writes before continuing. */
|
" dsb \n" /* Force memory writes before continuing. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_context_first_task: \n"
|
" restore_context_first_task: \n"
|
||||||
" ldr r3, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* r1 = pxCurrentTCB.*/
|
" ldr r1, [r3] \n" /* r1 = pxCurrentTCB.*/
|
||||||
" ldr r2, [r1] \n" /* r2 = Location of saved context in TCB. */
|
" ldr r2, [r1] \n" /* r2 = Location of saved context in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_special_regs_first_task: \n"
|
" restore_special_regs_first_task: \n"
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" ldmdb r2!, {r3-r6} \n" /* Read task's dedicated PAC key from the task's context. */
|
||||||
|
" msr PAC_KEY_P_0, r3 \n" /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
" msr PAC_KEY_P_1, r4 \n"
|
||||||
|
" msr PAC_KEY_P_2, r5 \n"
|
||||||
|
" msr PAC_KEY_P_3, r6 \n"
|
||||||
|
" clrm {r3-r6} \n" /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
" ldmdb r2!, {r0, r3-r5, lr} \n" /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, LR restored. */
|
" ldmdb r2!, {r0, r3-r5, lr} \n" /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, LR restored. */
|
||||||
" msr psp, r3 \n"
|
" msr psp, r3 \n"
|
||||||
" msr psplim, r4 \n"
|
" msr psplim, r4 \n"
|
||||||
" msr control, r5 \n"
|
" msr control, r5 \n"
|
||||||
" ldr r4, xSecureContextConst2 \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r4, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" str r0, [r4] \n" /* Restore xSecureContext. */
|
" str r0, [r4] \n" /* Restore xSecureContext. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_general_regs_first_task: \n"
|
" restore_general_regs_first_task: \n"
|
||||||
|
@ -112,14 +125,6 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" mov r0, #0 \n"
|
" mov r0, #0 \n"
|
||||||
" msr basepri, r0 \n" /* Ensure that interrupts are enabled when the first task starts. */
|
" msr basepri, r0 \n" /* Ensure that interrupts are enabled when the first task starts. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
" pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
|
||||||
" xSecureContextConst2: .word xSecureContext \n"
|
|
||||||
" xMPUCTRLConst2: .word 0xe000ed94 \n"
|
|
||||||
" xMAIR0Const2: .word 0xe000edc0 \n"
|
|
||||||
" xRNRConst2: .word 0xe000ed98 \n"
|
|
||||||
" xRBARConst2: .word 0xe000ed9c \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,25 +136,32 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r3, [r2] \n" /* Read pxCurrentTCB. */
|
" ldr r3, [r2] \n" /* Read pxCurrentTCB. */
|
||||||
" ldr r0, [r3] \n" /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
" ldr r0, [r3] \n" /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
||||||
" \n"
|
" \n"
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" ldmia r0!, {r1-r4} \n" /* Read task's dedicated PAC key from stack. */
|
||||||
|
" msr PAC_KEY_P_3, r1 \n" /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
" msr PAC_KEY_P_2, r2 \n"
|
||||||
|
" msr PAC_KEY_P_1, r3 \n"
|
||||||
|
" msr PAC_KEY_P_0, r4 \n"
|
||||||
|
" clrm {r1-r4} \n" /* Clear r1-r4. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
" \n"
|
||||||
" ldm r0!, {r1-r3} \n" /* Read from stack - r1 = xSecureContext, r2 = PSPLIM and r3 = EXC_RETURN. */
|
" ldm r0!, {r1-r3} \n" /* Read from stack - r1 = xSecureContext, r2 = PSPLIM and r3 = EXC_RETURN. */
|
||||||
" ldr r4, xSecureContextConst2 \n"
|
" ldr r4, =xSecureContext \n"
|
||||||
" str r1, [r4] \n" /* Set xSecureContext to this task's value for the same. */
|
" str r1, [r4] \n" /* Set xSecureContext to this task's value for the same. */
|
||||||
" msr psplim, r2 \n" /* Set this task's PSPLIM value. */
|
" msr psplim, r2 \n" /* Set this task's PSPLIM value. */
|
||||||
" movs r1, #2 \n" /* r1 = 2. */
|
" mrs r1, control \n" /* Obtain current control register value. */
|
||||||
" msr CONTROL, r1 \n" /* Switch to use PSP in the thread mode. */
|
" orrs r1, r1, #2 \n" /* r1 = r1 | 0x2 - Set the second bit to use the program stack pointer (PSP). */
|
||||||
|
" msr control, r1 \n" /* Write back the new control register value. */
|
||||||
" adds r0, #32 \n" /* Discard everything up to r0. */
|
" adds r0, #32 \n" /* Discard everything up to r0. */
|
||||||
" msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
|
" msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
|
||||||
" isb \n"
|
" isb \n"
|
||||||
" mov r0, #0 \n"
|
" mov r0, #0 \n"
|
||||||
" msr basepri, r0 \n" /* Ensure that interrupts are enabled when the first task starts. */
|
" msr basepri, r0 \n" /* Ensure that interrupts are enabled when the first task starts. */
|
||||||
" bx r3 \n" /* Finally, branch to EXC_RETURN. */
|
" bx r3 \n" /* Finally, branch to EXC_RETURN. */
|
||||||
" .align 4 \n"
|
|
||||||
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
|
||||||
"xSecureContextConst2: .word xSecureContext \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,8 +180,6 @@ BaseType_t xIsPrivileged( void ) /* __attribute__ (( naked )) */
|
||||||
" movne r0, #0 \n" /* CONTROL[0]!=0. Return false to indicate that the processor is not privileged. */
|
" movne r0, #0 \n" /* CONTROL[0]!=0. Return false to indicate that the processor is not privileged. */
|
||||||
" moveq r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
|
" moveq r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
|
||||||
" bx lr \n" /* Return. */
|
" bx lr \n" /* Return. */
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
::: "r0", "memory"
|
::: "r0", "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -211,7 +221,7 @@ void vStartFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r0, xVTORConst \n"/* Use the NVIC offset register to locate the stack. */
|
" ldr r0, =0xe000ed08 \n" /* Use the NVIC offset register to locate the stack. */
|
||||||
" ldr r0, [r0] \n" /* Read the VTOR register which gives the address of vector table. */
|
" ldr r0, [r0] \n" /* Read the VTOR register which gives the address of vector table. */
|
||||||
" ldr r0, [r0] \n" /* The first entry in vector table is stack pointer. */
|
" ldr r0, [r0] \n" /* The first entry in vector table is stack pointer. */
|
||||||
" msr msp, r0 \n" /* Set the MSP back to the start of the stack. */
|
" msr msp, r0 \n" /* Set the MSP back to the start of the stack. */
|
||||||
|
@ -221,9 +231,6 @@ void vStartFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" isb \n"
|
" isb \n"
|
||||||
" svc %0 \n" /* System call to start the first task. */
|
" svc %0 \n" /* System call to start the first task. */
|
||||||
" nop \n"
|
" nop \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"xVTORConst: .word 0xe000ed08 \n"
|
|
||||||
::"i" ( portSVC_START_SCHEDULER ) : "memory"
|
::"i" ( portSVC_START_SCHEDULER ) : "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -271,9 +278,9 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" .extern SecureContext_SaveContext \n"
|
" .extern SecureContext_SaveContext \n"
|
||||||
" .extern SecureContext_LoadContext \n"
|
" .extern SecureContext_LoadContext \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r3, xSecureContextConst \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r3, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" ldr r0, [r3] \n" /* Read xSecureContext - Value of xSecureContext must be in r0 as it is used as a parameter later. */
|
" ldr r0, [r3] \n" /* Read xSecureContext - Value of xSecureContext must be in r0 as it is used as a parameter later. */
|
||||||
" ldr r3, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB - Value of pxCurrentTCB must be in r1 as it is used as a parameter later. */
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB - Value of pxCurrentTCB must be in r1 as it is used as a parameter later. */
|
||||||
" ldr r2, [r1] \n" /* r2 = Location in TCB where the context should be saved. */
|
" ldr r2, [r1] \n" /* r2 = Location in TCB where the context should be saved. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -290,7 +297,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" \n"
|
" \n"
|
||||||
" save_general_regs: \n"
|
" save_general_regs: \n"
|
||||||
" mrs r3, psp \n"
|
" mrs r3, psp \n"
|
||||||
" \n"
|
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
" add r3, r3, #0x20 \n" /* Move r3 to location where s0 is saved. */
|
" add r3, r3, #0x20 \n" /* Move r3 to location where s0 is saved. */
|
||||||
" tst lr, #0x10 \n"
|
" tst lr, #0x10 \n"
|
||||||
|
@ -300,7 +306,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" vstmiaeq r2!, {s0-s16} \n" /* Store hardware saved FP context. */
|
" vstmiaeq r2!, {s0-s16} \n" /* Store hardware saved FP context. */
|
||||||
" sub r3, r3, #0x20 \n" /* Set r3 back to the location of hardware saved context. */
|
" sub r3, r3, #0x20 \n" /* Set r3 back to the location of hardware saved context. */
|
||||||
#endif /* configENABLE_FPU || configENABLE_MVE */
|
#endif /* configENABLE_FPU || configENABLE_MVE */
|
||||||
" \n"
|
|
||||||
" stmia r2!, {r4-r11} \n" /* Store r4-r11. */
|
" stmia r2!, {r4-r11} \n" /* Store r4-r11. */
|
||||||
" ldmia r3, {r4-r11} \n" /* Copy the hardware saved context into r4-r11. */
|
" ldmia r3, {r4-r11} \n" /* Copy the hardware saved context into r4-r11. */
|
||||||
" stmia r2!, {r4-r11} \n" /* Store the hardware saved context. */
|
" stmia r2!, {r4-r11} \n" /* Store the hardware saved context. */
|
||||||
|
@ -310,6 +315,14 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" mrs r4, psplim \n" /* r4 = PSPLIM. */
|
" mrs r4, psplim \n" /* r4 = PSPLIM. */
|
||||||
" mrs r5, control \n" /* r5 = CONTROL. */
|
" mrs r5, control \n" /* r5 = CONTROL. */
|
||||||
" stmia r2!, {r0, r3-r5, lr} \n" /* Store xSecureContext, original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
" stmia r2!, {r0, r3-r5, lr} \n" /* Store xSecureContext, original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" mrs r3, PAC_KEY_P_0 \n" /* Read task's dedicated PAC key from the PAC key registers. */
|
||||||
|
" mrs r4, PAC_KEY_P_1 \n"
|
||||||
|
" mrs r5, PAC_KEY_P_2 \n"
|
||||||
|
" mrs r6, PAC_KEY_P_3 \n"
|
||||||
|
" stmia r2!, {r3-r6} \n" /* Store the task's dedicated PAC key on the task's context. */
|
||||||
|
" clrm {r3-r6} \n" /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
" str r2, [r1] \n" /* Save the location from where the context should be restored as the first member of TCB. */
|
" str r2, [r1] \n" /* Save the location from where the context should be restored as the first member of TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" select_next_task: \n"
|
" select_next_task: \n"
|
||||||
|
@ -322,23 +335,23 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" msr basepri, r0 \n" /* Enable interrupts. */
|
" msr basepri, r0 \n" /* Enable interrupts. */
|
||||||
" \n"
|
" \n"
|
||||||
" program_mpu: \n"
|
" program_mpu: \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r3] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" \n"
|
" \n"
|
||||||
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
||||||
" ldr r1, xMPUCTRLConst \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" bic r2, #1 \n" /* r2 = r2 & ~1 i.e. Clear the bit 0 in r2. */
|
" bic r2, #1 \n" /* r2 = r2 & ~1 i.e. Clear the bit 0 in r2. */
|
||||||
" str r2, [r1] \n" /* Disable MPU. */
|
" str r2, [r1] \n" /* Disable MPU. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
||||||
" ldr r2, xMAIR0Const \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
" ldr r2, =0xe000edc0 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
||||||
" str r1, [r2] \n" /* Program MAIR0. */
|
" str r1, [r2] \n" /* Program MAIR0. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
||||||
" ldr r1, xRNRConst \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
" ldr r1, =0xe000ed98 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" \n"
|
" \n"
|
||||||
" movs r3, #4 \n" /* r3 = 4. */
|
" movs r3, #4 \n" /* r3 = 4. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 4. */
|
" str r3, [r1] \n" /* Program RNR = 4. */
|
||||||
|
@ -356,23 +369,31 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" stmia r2, {r4-r11} \n" /* Write 4 set of RBAR/RLAR registers using alias registers. */
|
" stmia r2, {r4-r11} \n" /* Write 4 set of RBAR/RLAR registers using alias registers. */
|
||||||
#endif /* configTOTAL_MPU_REGIONS == 16 */
|
#endif /* configTOTAL_MPU_REGIONS == 16 */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r1, xMPUCTRLConst \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" orr r2, #1 \n" /* r2 = r2 | 1 i.e. Set the bit 0 in r2. */
|
" orr r2, #1 \n" /* r2 = r2 | 1 i.e. Set the bit 0 in r2. */
|
||||||
" str r2, [r1] \n" /* Enable MPU. */
|
" str r2, [r1] \n" /* Enable MPU. */
|
||||||
" dsb \n" /* Force memory writes before continuing. */
|
" dsb \n" /* Force memory writes before continuing. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_context: \n"
|
" restore_context: \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* r1 = pxCurrentTCB.*/
|
" ldr r1, [r3] \n" /* r1 = pxCurrentTCB.*/
|
||||||
" ldr r2, [r1] \n" /* r2 = Location of saved context in TCB. */
|
" ldr r2, [r1] \n" /* r2 = Location of saved context in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_special_regs: \n"
|
" restore_special_regs: \n"
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" ldmdb r2!, {r3-r6} \n" /* Read task's dedicated PAC key from the task's context. */
|
||||||
|
" msr PAC_KEY_P_0, r3 \n" /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
" msr PAC_KEY_P_1, r4 \n"
|
||||||
|
" msr PAC_KEY_P_2, r5 \n"
|
||||||
|
" msr PAC_KEY_P_3, r6 \n"
|
||||||
|
" clrm {r3-r6} \n" /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
" ldmdb r2!, {r0, r3-r5, lr} \n" /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, LR restored. */
|
" ldmdb r2!, {r0, r3-r5, lr} \n" /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, LR restored. */
|
||||||
" msr psp, r3 \n"
|
" msr psp, r3 \n"
|
||||||
" msr psplim, r4 \n"
|
" msr psplim, r4 \n"
|
||||||
" msr control, r5 \n"
|
" msr control, r5 \n"
|
||||||
" ldr r4, xSecureContextConst \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r4, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" str r0, [r4] \n" /* Restore xSecureContext. */
|
" str r0, [r4] \n" /* Restore xSecureContext. */
|
||||||
" cbz r0, restore_ns_context \n" /* No secure context to restore. */
|
" cbz r0, restore_ns_context \n" /* No secure context to restore. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -401,14 +422,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" restore_context_done: \n"
|
" restore_context_done: \n"
|
||||||
" str r2, [r1] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
" str r2, [r1] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
" pxCurrentTCBConst: .word pxCurrentTCB \n"
|
|
||||||
" xSecureContextConst: .word xSecureContext \n"
|
|
||||||
" xMPUCTRLConst: .word 0xe000ed94 \n"
|
|
||||||
" xMAIR0Const: .word 0xe000edc0 \n"
|
|
||||||
" xRNRConst: .word 0xe000ed98 \n"
|
|
||||||
" xRBARConst: .word 0xe000ed9c \n"
|
|
||||||
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -423,45 +436,44 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" .extern SecureContext_SaveContext \n"
|
" .extern SecureContext_SaveContext \n"
|
||||||
" .extern SecureContext_LoadContext \n"
|
" .extern SecureContext_LoadContext \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r3, xSecureContextConst \n"/* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" ldr r3, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" ldr r0, [r3] \n" /* Read xSecureContext - Value of xSecureContext must be in r0 as it is used as a parameter later. */
|
" ldr r0, [r3] \n" /* Read xSecureContext - Value of xSecureContext must be in r0 as it is used as a parameter later. */
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB - Value of pxCurrentTCB must be in r1 as it is used as a parameter later. */
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB - Value of pxCurrentTCB must be in r1 as it is used as a parameter later. */
|
||||||
" mrs r2, psp \n" /* Read PSP in r2. */
|
" mrs r2, psp \n" /* Read PSP in r2. */
|
||||||
" \n"
|
" \n"
|
||||||
" cbz r0, save_ns_context \n" /* No secure context to save. */
|
" cbz r0, save_ns_context \n" /* No secure context to save. */
|
||||||
" push {r0-r2, r14} \n"
|
" save_s_context: \n"
|
||||||
|
" push {r0-r2, lr} \n"
|
||||||
" bl SecureContext_SaveContext \n" /* Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
" bl SecureContext_SaveContext \n" /* Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
||||||
" pop {r0-r3} \n"/* LR is now in r3. */
|
" pop {r0-r2, lr} \n"
|
||||||
" mov lr, r3 \n"/* LR = r3. */
|
|
||||||
" lsls r1, r3, #25 \n"/* r1 = r3 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
|
||||||
" bpl save_ns_context \n"/* bpl - branch if positive or zero. If r1 >= 0 ==> Bit[6] in EXC_RETURN is 0 i.e. non-secure stack was used. */
|
|
||||||
" \n"
|
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
|
||||||
" ldr r1, [r3] \n"/* Read pxCurrentTCB.*/
|
|
||||||
" subs r2, r2, #12 \n"/* Make space for xSecureContext, PSPLIM and LR on the stack. */
|
|
||||||
" str r2, [r1] \n"/* Save the new top of stack in TCB. */
|
|
||||||
" mrs r1, psplim \n"/* r1 = PSPLIM. */
|
|
||||||
" mov r3, lr \n"/* r3 = LR/EXC_RETURN. */
|
|
||||||
" stmia r2!, {r0, r1, r3} \n"/* Store xSecureContext, PSPLIM and LR on the stack. */
|
|
||||||
" b select_next_task \n"
|
|
||||||
" \n"
|
" \n"
|
||||||
" save_ns_context: \n"
|
" save_ns_context: \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" mov r3, lr \n" /* r3 = LR (EXC_RETURN). */
|
||||||
" ldr r1, [r3] \n"/* Read pxCurrentTCB. */
|
" lsls r3, r3, #25 \n" /* r3 = r3 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
||||||
|
" bmi save_special_regs \n" /* If r3 < 0 ==> Bit[6] in EXC_RETURN is 1 ==> secure stack was used. */
|
||||||
|
" \n"
|
||||||
|
" save_general_regs: \n"
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
" tst lr, #0x10 \n" /* Test Bit[4] in LR. Bit[4] of EXC_RETURN is 0 if the Extended Stack Frame is in use. */
|
" tst lr, #0x10 \n" /* Test Bit[4] in LR. Bit[4] of EXC_RETURN is 0 if the Extended Stack Frame is in use. */
|
||||||
" it eq \n"
|
" it eq \n"
|
||||||
" vstmdbeq r2!, {s16-s31} \n" /* Store the additional FP context registers which are not saved automatically. */
|
" vstmdbeq r2!, {s16-s31} \n" /* Store the additional FP context registers which are not saved automatically. */
|
||||||
#endif /* configENABLE_FPU || configENABLE_MVE */
|
#endif /* configENABLE_FPU || configENABLE_MVE */
|
||||||
" subs r2, r2, #44 \n"/* Make space for xSecureContext, PSPLIM, LR and the remaining registers on the stack. */
|
" stmdb r2!, {r4-r11} \n" /* Store the registers that are not saved automatically. */
|
||||||
|
" \n"
|
||||||
|
" save_special_regs: \n"
|
||||||
|
" mrs r3, psplim \n" /* r3 = PSPLIM. */
|
||||||
|
" stmdb r2!, {r0, r3, lr} \n" /* Store xSecureContext, PSPLIM and LR on the stack. */
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" mrs r3, PAC_KEY_P_3 \n" /* Read task's dedicated PAC key from the PAC key registers. */
|
||||||
|
" mrs r4, PAC_KEY_P_2 \n"
|
||||||
|
" mrs r5, PAC_KEY_P_1 \n"
|
||||||
|
" mrs r6, PAC_KEY_P_0 \n"
|
||||||
|
" stmdb r2!, {r3-r6} \n" /* Store the task's dedicated PAC key on the stack. */
|
||||||
|
" clrm {r3-r6} \n" /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
" \n"
|
||||||
" str r2, [r1] \n" /* Save the new top of stack in TCB. */
|
" str r2, [r1] \n" /* Save the new top of stack in TCB. */
|
||||||
" adds r2, r2, #12 \n"/* r2 = r2 + 12. */
|
|
||||||
" stm r2, {r4-r11} \n"/* Store the registers that are not saved automatically. */
|
|
||||||
" mrs r1, psplim \n"/* r1 = PSPLIM. */
|
|
||||||
" mov r3, lr \n"/* r3 = LR/EXC_RETURN. */
|
|
||||||
" subs r2, r2, #12 \n"/* r2 = r2 - 12. */
|
|
||||||
" stmia r2!, {r0, r1, r3} \n"/* Store xSecureContext, PSPLIM and LR on the stack. */
|
|
||||||
" \n"
|
" \n"
|
||||||
" select_next_task: \n"
|
" select_next_task: \n"
|
||||||
" mov r0, %0 \n" /* r0 = configMAX_SYSCALL_INTERRUPT_PRIORITY */
|
" mov r0, %0 \n" /* r0 = configMAX_SYSCALL_INTERRUPT_PRIORITY */
|
||||||
|
@ -472,40 +484,47 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" mov r0, #0 \n" /* r0 = 0. */
|
" mov r0, #0 \n" /* r0 = 0. */
|
||||||
" msr basepri, r0 \n" /* Enable interrupts. */
|
" msr basepri, r0 \n" /* Enable interrupts. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" restore_context: \n"
|
||||||
|
" ldr r3, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r3] \n" /* Read pxCurrentTCB. */
|
||||||
" ldr r2, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r2 now points to the top of stack. */
|
" ldr r2, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r2 now points to the top of stack. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldmia r2!, {r0, r1, r4} \n"/* Read from stack - r0 = xSecureContext, r1 = PSPLIM and r4 = LR. */
|
" restore_special_regs: \n"
|
||||||
" msr psplim, r1 \n"/* Restore the PSPLIM register value for the task. */
|
#if ( configENABLE_PAC == 1 )
|
||||||
" mov lr, r4 \n"/* LR = r4. */
|
" ldmia r2!, {r3-r6} \n" /* Read task's dedicated PAC key from stack. */
|
||||||
" ldr r3, xSecureContextConst \n"/* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
" msr PAC_KEY_P_3, r3 \n" /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
" msr PAC_KEY_P_2, r4 \n"
|
||||||
|
" msr PAC_KEY_P_1, r5 \n"
|
||||||
|
" msr PAC_KEY_P_0, r6 \n"
|
||||||
|
" clrm {r3-r6} \n" /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
" ldmia r2!, {r0, r3, lr} \n" /* Read from stack - r0 = xSecureContext, r3 = PSPLIM and LR restored. */
|
||||||
|
" msr psplim, r3 \n" /* Restore the PSPLIM register value for the task. */
|
||||||
|
" ldr r3, =xSecureContext \n" /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
" str r0, [r3] \n" /* Restore the task's xSecureContext. */
|
" str r0, [r3] \n" /* Restore the task's xSecureContext. */
|
||||||
" cbz r0, restore_ns_context \n" /* If there is no secure context for the task, restore the non-secure context. */
|
" cbz r0, restore_ns_context \n" /* If there is no secure context for the task, restore the non-secure context. */
|
||||||
" ldr r3, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" \n"
|
||||||
" ldr r1, [r3] \n"/* Read pxCurrentTCB. */
|
" restore_s_context: \n"
|
||||||
" push {r2, r4} \n"
|
" push {r1-r3, lr} \n"
|
||||||
" bl SecureContext_LoadContext \n" /* Restore the secure context. Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
" bl SecureContext_LoadContext \n" /* Restore the secure context. Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
||||||
" pop {r2, r4} \n"
|
" pop {r1-r3, lr} \n"
|
||||||
" mov lr, r4 \n"/* LR = r4. */
|
|
||||||
" lsls r1, r4, #25 \n"/* r1 = r4 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
|
||||||
" bpl restore_ns_context \n"/* bpl - branch if positive or zero. If r1 >= 0 ==> Bit[6] in EXC_RETURN is 0 i.e. non-secure stack was used. */
|
|
||||||
" msr psp, r2 \n"/* Remember the new top of stack for the task. */
|
|
||||||
" bx lr \n"
|
|
||||||
" \n"
|
" \n"
|
||||||
" restore_ns_context: \n"
|
" restore_ns_context: \n"
|
||||||
|
" mov r0, lr \n" /* r0 = LR (EXC_RETURN). */
|
||||||
|
" lsls r0, r0, #25 \n" /* r0 = r0 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
||||||
|
" bmi restore_context_done \n" /* r0 < 0 ==> Bit[6] in EXC_RETURN is 1 ==> secure stack was used to store the stack frame. */
|
||||||
|
" \n"
|
||||||
|
" restore_general_regs: \n"
|
||||||
" ldmia r2!, {r4-r11} \n" /* Restore the registers that are not automatically restored. */
|
" ldmia r2!, {r4-r11} \n" /* Restore the registers that are not automatically restored. */
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
" tst lr, #0x10 \n" /* Test Bit[4] in LR. Bit[4] of EXC_RETURN is 0 if the Extended Stack Frame is in use. */
|
" tst lr, #0x10 \n" /* Test Bit[4] in LR. Bit[4] of EXC_RETURN is 0 if the Extended Stack Frame is in use. */
|
||||||
" it eq \n"
|
" it eq \n"
|
||||||
" vldmiaeq r2!, {s16-s31} \n" /* Restore the additional FP context registers which are not restored automatically. */
|
" vldmiaeq r2!, {s16-s31} \n" /* Restore the additional FP context registers which are not restored automatically. */
|
||||||
#endif /* configENABLE_FPU || configENABLE_MVE */
|
#endif /* configENABLE_FPU || configENABLE_MVE */
|
||||||
|
" \n"
|
||||||
|
" restore_context_done: \n"
|
||||||
" msr psp, r2 \n" /* Remember the new top of stack for the task. */
|
" msr psp, r2 \n" /* Remember the new top of stack for the task. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"pxCurrentTCBConst: .word pxCurrentTCB \n"
|
|
||||||
"xSecureContextConst: .word xSecureContext \n"
|
|
||||||
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -522,7 +541,6 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
".syntax unified \n"
|
".syntax unified \n"
|
||||||
".extern vPortSVCHandler_C \n"
|
".extern vPortSVCHandler_C \n"
|
||||||
".extern vSystemCallEnter \n"
|
".extern vSystemCallEnter \n"
|
||||||
".extern vSystemCallEnter_1 \n"
|
|
||||||
".extern vSystemCallExit \n"
|
".extern vSystemCallExit \n"
|
||||||
" \n"
|
" \n"
|
||||||
"tst lr, #4 \n"
|
"tst lr, #4 \n"
|
||||||
|
@ -533,10 +551,8 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
"ldr r1, [r0, #24] \n"
|
"ldr r1, [r0, #24] \n"
|
||||||
"ldrb r2, [r1, #-2] \n"
|
"ldrb r2, [r1, #-2] \n"
|
||||||
"cmp r2, %0 \n"
|
"cmp r2, %0 \n"
|
||||||
"beq syscall_enter \n"
|
"blt syscall_enter \n"
|
||||||
"cmp r2, %1 \n"
|
"cmp r2, %1 \n"
|
||||||
"beq syscall_enter_1 \n"
|
|
||||||
"cmp r2, %2 \n"
|
|
||||||
"beq syscall_exit \n"
|
"beq syscall_exit \n"
|
||||||
"b vPortSVCHandler_C \n"
|
"b vPortSVCHandler_C \n"
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -544,16 +560,12 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" mov r1, lr \n"
|
" mov r1, lr \n"
|
||||||
" b vSystemCallEnter \n"
|
" b vSystemCallEnter \n"
|
||||||
" \n"
|
" \n"
|
||||||
"syscall_enter_1: \n"
|
|
||||||
" mov r1, lr \n"
|
|
||||||
" b vSystemCallEnter_1 \n"
|
|
||||||
" \n"
|
|
||||||
"syscall_exit: \n"
|
"syscall_exit: \n"
|
||||||
" mov r1, lr \n"
|
" mov r1, lr \n"
|
||||||
" b vSystemCallExit \n"
|
" b vSystemCallExit \n"
|
||||||
" \n"
|
" \n"
|
||||||
: /* No outputs. */
|
: /* No outputs. */
|
||||||
:"i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT )
|
: "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT )
|
||||||
: "r0", "r1", "r2", "memory"
|
: "r0", "r1", "r2", "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -570,11 +582,8 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" ite eq \n"
|
" ite eq \n"
|
||||||
" mrseq r0, msp \n"
|
" mrseq r0, msp \n"
|
||||||
" mrsne r0, psp \n"
|
" mrsne r0, psp \n"
|
||||||
" ldr r1, svchandler_address_const \n"
|
" ldr r1, =vPortSVCHandler_C \n"
|
||||||
" bx r1 \n"
|
" bx r1 \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"svchandler_address_const: .word vPortSVCHandler_C \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M33"
|
#define portARCH_NAME "Cortex-M33"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -57,6 +58,13 @@
|
||||||
#include "portmacrocommon.h"
|
#include "portmacrocommon.h"
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef configENABLE_MVE
|
||||||
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Critical section management.
|
* @brief Critical section management.
|
||||||
*/
|
*/
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
* Copyright 2024 Arm Limited and/or its affiliates
|
||||||
|
* <open-source-office@arm.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -36,6 +38,9 @@
|
||||||
/* Portasm includes. */
|
/* Portasm includes. */
|
||||||
#include "portasm.h"
|
#include "portasm.h"
|
||||||
|
|
||||||
|
/* System call numbers includes. */
|
||||||
|
#include "mpu_syscall_numbers.h"
|
||||||
|
|
||||||
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the
|
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE is needed to be defined only for the
|
||||||
* header files. */
|
* header files. */
|
||||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
@ -49,23 +54,23 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" program_mpu_first_task: \n"
|
" program_mpu_first_task: \n"
|
||||||
" ldr r2, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB. */
|
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
||||||
" ldr r1, xMPUCTRLConst2 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" bic r2, #1 \n" /* r2 = r2 & ~1 i.e. Clear the bit 0 in r2. */
|
" bic r2, #1 \n" /* r2 = r2 & ~1 i.e. Clear the bit 0 in r2. */
|
||||||
" str r2, [r1] \n" /* Disable MPU. */
|
" str r2, [r1] \n" /* Disable MPU. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
||||||
" ldr r2, xMAIR0Const2 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
" ldr r2, =0xe000edc0 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
||||||
" str r1, [r2] \n" /* Program MAIR0. */
|
" str r1, [r2] \n" /* Program MAIR0. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
||||||
" ldr r1, xRNRConst2 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
" ldr r1, =0xe000ed98 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
||||||
" ldr r2, xRBARConst2 \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" \n"
|
" \n"
|
||||||
" movs r3, #4 \n" /* r3 = 4. */
|
" movs r3, #4 \n" /* r3 = 4. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 4. */
|
" str r3, [r1] \n" /* Program RNR = 4. */
|
||||||
|
@ -83,18 +88,26 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" stmia r2, {r4-r11} \n" /* Write 4 set of RBAR/RLAR registers using alias registers. */
|
" stmia r2, {r4-r11} \n" /* Write 4 set of RBAR/RLAR registers using alias registers. */
|
||||||
#endif /* configTOTAL_MPU_REGIONS == 16 */
|
#endif /* configTOTAL_MPU_REGIONS == 16 */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r1, xMPUCTRLConst2 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" orr r2, #1 \n" /* r2 = r2 | 1 i.e. Set the bit 0 in r2. */
|
" orr r2, #1 \n" /* r2 = r2 | 1 i.e. Set the bit 0 in r2. */
|
||||||
" str r2, [r1] \n" /* Enable MPU. */
|
" str r2, [r1] \n" /* Enable MPU. */
|
||||||
" dsb \n" /* Force memory writes before continuing. */
|
" dsb \n" /* Force memory writes before continuing. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_context_first_task: \n"
|
" restore_context_first_task: \n"
|
||||||
" ldr r2, pxCurrentTCBConst2 \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" ldr r1, [r0] \n" /* r1 = Location of saved context in TCB. */
|
" ldr r1, [r0] \n" /* r1 = Location of saved context in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_special_regs_first_task: \n"
|
" restore_special_regs_first_task: \n"
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" ldmdb r1!, {r2-r5} \n" /* Read task's dedicated PAC key from the task's context. */
|
||||||
|
" msr PAC_KEY_P_0, r2 \n" /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
" msr PAC_KEY_P_1, r3 \n"
|
||||||
|
" msr PAC_KEY_P_2, r4 \n"
|
||||||
|
" msr PAC_KEY_P_3, r5 \n"
|
||||||
|
" clrm {r2-r5} \n" /* Clear r2-r5. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
" ldmdb r1!, {r2-r4, lr} \n" /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, LR restored. */
|
" ldmdb r1!, {r2-r4, lr} \n" /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, LR restored. */
|
||||||
" msr psp, r2 \n"
|
" msr psp, r2 \n"
|
||||||
" msr psplim, r3 \n"
|
" msr psplim, r3 \n"
|
||||||
|
@ -110,13 +123,6 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
" mov r0, #0 \n"
|
" mov r0, #0 \n"
|
||||||
" msr basepri, r0 \n" /* Ensure that interrupts are enabled when the first task starts. */
|
" msr basepri, r0 \n" /* Ensure that interrupts are enabled when the first task starts. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
" pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
|
||||||
" xMPUCTRLConst2: .word 0xe000ed94 \n"
|
|
||||||
" xMAIR0Const2: .word 0xe000edc0 \n"
|
|
||||||
" xRNRConst2: .word 0xe000ed98 \n"
|
|
||||||
" xRBARConst2: .word 0xe000ed9c \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,23 +134,30 @@ void vRestoreContextOfFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst2 \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
||||||
" ldr r0, [r1] \n" /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
" ldr r0, [r1] \n" /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
||||||
" \n"
|
" \n"
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" ldmia r0!, {r1-r4} \n" /* Read task's dedicated PAC key from stack. */
|
||||||
|
" msr PAC_KEY_P_3, r1 \n" /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
" msr PAC_KEY_P_2, r2 \n"
|
||||||
|
" msr PAC_KEY_P_1, r3 \n"
|
||||||
|
" msr PAC_KEY_P_0, r4 \n"
|
||||||
|
" clrm {r1-r4} \n" /* Clear r1-r4. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
" \n"
|
||||||
" ldm r0!, {r1-r2} \n" /* Read from stack - r1 = PSPLIM and r2 = EXC_RETURN. */
|
" ldm r0!, {r1-r2} \n" /* Read from stack - r1 = PSPLIM and r2 = EXC_RETURN. */
|
||||||
" msr psplim, r1 \n" /* Set this task's PSPLIM value. */
|
" msr psplim, r1 \n" /* Set this task's PSPLIM value. */
|
||||||
" movs r1, #2 \n"/* r1 = 2. */
|
" mrs r1, control \n" /* Obtain current control register value. */
|
||||||
" msr CONTROL, r1 \n"/* Switch to use PSP in the thread mode. */
|
" orrs r1, r1, #2 \n" /* r1 = r1 | 0x2 - Set the second bit to use the program stack pointer (PSP). */
|
||||||
|
" msr control, r1 \n" /* Write back the new control register value. */
|
||||||
" adds r0, #32 \n" /* Discard everything up to r0. */
|
" adds r0, #32 \n" /* Discard everything up to r0. */
|
||||||
" msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
|
" msr psp, r0 \n" /* This is now the new top of stack to use in the task. */
|
||||||
" isb \n"
|
" isb \n"
|
||||||
" mov r0, #0 \n"
|
" mov r0, #0 \n"
|
||||||
" msr basepri, r0 \n" /* Ensure that interrupts are enabled when the first task starts. */
|
" msr basepri, r0 \n" /* Ensure that interrupts are enabled when the first task starts. */
|
||||||
" bx r2 \n" /* Finally, branch to EXC_RETURN. */
|
" bx r2 \n" /* Finally, branch to EXC_RETURN. */
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +176,6 @@ BaseType_t xIsPrivileged( void ) /* __attribute__ (( naked )) */
|
||||||
" movne r0, #0 \n" /* CONTROL[0]!=0. Return false to indicate that the processor is not privileged. */
|
" movne r0, #0 \n" /* CONTROL[0]!=0. Return false to indicate that the processor is not privileged. */
|
||||||
" moveq r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
|
" moveq r0, #1 \n" /* CONTROL[0]==0. Return true to indicate that the processor is privileged. */
|
||||||
" bx lr \n" /* Return. */
|
" bx lr \n" /* Return. */
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
::: "r0", "memory"
|
::: "r0", "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -206,7 +217,7 @@ void vStartFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r0, xVTORConst \n"/* Use the NVIC offset register to locate the stack. */
|
" ldr r0, =0xe000ed08 \n" /* Use the NVIC offset register to locate the stack. */
|
||||||
" ldr r0, [r0] \n" /* Read the VTOR register which gives the address of vector table. */
|
" ldr r0, [r0] \n" /* Read the VTOR register which gives the address of vector table. */
|
||||||
" ldr r0, [r0] \n" /* The first entry in vector table is stack pointer. */
|
" ldr r0, [r0] \n" /* The first entry in vector table is stack pointer. */
|
||||||
" msr msp, r0 \n" /* Set the MSP back to the start of the stack. */
|
" msr msp, r0 \n" /* Set the MSP back to the start of the stack. */
|
||||||
|
@ -216,9 +227,6 @@ void vStartFirstTask( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" isb \n"
|
" isb \n"
|
||||||
" svc %0 \n" /* System call to start the first task. */
|
" svc %0 \n" /* System call to start the first task. */
|
||||||
" nop \n"
|
" nop \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"xVTORConst: .word 0xe000ed08 \n"
|
|
||||||
::"i" ( portSVC_START_SCHEDULER ) : "memory"
|
::"i" ( portSVC_START_SCHEDULER ) : "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -264,7 +272,7 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
(
|
(
|
||||||
" .syntax unified \n"
|
" .syntax unified \n"
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB. */
|
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = Location in TCB where the context should be saved. */
|
" ldr r1, [r0] \n" /* r1 = Location in TCB where the context should be saved. */
|
||||||
" mrs r2, psp \n" /* r2 = PSP. */
|
" mrs r2, psp \n" /* r2 = PSP. */
|
||||||
|
@ -279,7 +287,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" vstmiaeq r1!, {s0-s16} \n" /* Store hardware saved FP context. */
|
" vstmiaeq r1!, {s0-s16} \n" /* Store hardware saved FP context. */
|
||||||
" sub r2, r2, #0x20 \n" /* Set r2 back to the location of hardware saved context. */
|
" sub r2, r2, #0x20 \n" /* Set r2 back to the location of hardware saved context. */
|
||||||
#endif /* configENABLE_FPU || configENABLE_MVE */
|
#endif /* configENABLE_FPU || configENABLE_MVE */
|
||||||
" \n"
|
|
||||||
" stmia r1!, {r4-r11} \n" /* Store r4-r11. */
|
" stmia r1!, {r4-r11} \n" /* Store r4-r11. */
|
||||||
" ldmia r2, {r4-r11} \n" /* Copy the hardware saved context into r4-r11. */
|
" ldmia r2, {r4-r11} \n" /* Copy the hardware saved context into r4-r11. */
|
||||||
" stmia r1!, {r4-r11} \n" /* Store the hardware saved context. */
|
" stmia r1!, {r4-r11} \n" /* Store the hardware saved context. */
|
||||||
|
@ -288,6 +295,14 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" mrs r3, psplim \n" /* r3 = PSPLIM. */
|
" mrs r3, psplim \n" /* r3 = PSPLIM. */
|
||||||
" mrs r4, control \n" /* r4 = CONTROL. */
|
" mrs r4, control \n" /* r4 = CONTROL. */
|
||||||
" stmia r1!, {r2-r4, lr} \n" /* Store original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
" stmia r1!, {r2-r4, lr} \n" /* Store original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" mrs r2, PAC_KEY_P_0 \n" /* Read task's dedicated PAC key from the PAC key registers. */
|
||||||
|
" mrs r3, PAC_KEY_P_1 \n"
|
||||||
|
" mrs r4, PAC_KEY_P_2 \n"
|
||||||
|
" mrs r5, PAC_KEY_P_3 \n"
|
||||||
|
" stmia r1!, {r2-r5} \n" /* Store the task's dedicated PAC key on the task's context. */
|
||||||
|
" clrm {r2-r5} \n" /* Clear r2-r5. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
" str r1, [r0] \n" /* Save the location from where the context should be restored as the first member of TCB. */
|
" str r1, [r0] \n" /* Save the location from where the context should be restored as the first member of TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" select_next_task: \n"
|
" select_next_task: \n"
|
||||||
|
@ -300,23 +315,23 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" msr basepri, r0 \n" /* Enable interrupts. */
|
" msr basepri, r0 \n" /* Enable interrupts. */
|
||||||
" \n"
|
" \n"
|
||||||
" program_mpu: \n"
|
" program_mpu: \n"
|
||||||
" ldr r2, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB. */
|
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
" dmb \n" /* Complete outstanding transfers before disabling MPU. */
|
||||||
" ldr r1, xMPUCTRLConst \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" bic r2, #1 \n" /* r2 = r2 & ~1 i.e. Clear the bit 0 in r2. */
|
" bic r2, #1 \n" /* r2 = r2 & ~1 i.e. Clear the bit 0 in r2. */
|
||||||
" str r2, [r1] \n" /* Disable MPU. */
|
" str r2, [r1] \n" /* Disable MPU. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to MAIR0 in TCB. */
|
||||||
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
" ldr r1, [r0] \n" /* r1 = *r0 i.e. r1 = MAIR0. */
|
||||||
" ldr r2, xMAIR0Const \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
" ldr r2, =0xe000edc0 \n" /* r2 = 0xe000edc0 [Location of MAIR0]. */
|
||||||
" str r1, [r2] \n" /* Program MAIR0. */
|
" str r1, [r2] \n" /* Program MAIR0. */
|
||||||
" \n"
|
" \n"
|
||||||
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
" adds r0, #4 \n" /* r0 = r0 + 4. r0 now points to first RBAR in TCB. */
|
||||||
" ldr r1, xRNRConst \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
" ldr r1, =0xe000ed98 \n" /* r1 = 0xe000ed98 [Location of RNR]. */
|
||||||
" ldr r2, xRBARConst \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
" ldr r2, =0xe000ed9c \n" /* r2 = 0xe000ed9c [Location of RBAR]. */
|
||||||
" \n"
|
" \n"
|
||||||
" movs r3, #4 \n" /* r3 = 4. */
|
" movs r3, #4 \n" /* r3 = 4. */
|
||||||
" str r3, [r1] \n" /* Program RNR = 4. */
|
" str r3, [r1] \n" /* Program RNR = 4. */
|
||||||
|
@ -334,18 +349,26 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" stmia r2, {r4-r11} \n" /* Write 4 set of RBAR/RLAR registers using alias registers. */
|
" stmia r2, {r4-r11} \n" /* Write 4 set of RBAR/RLAR registers using alias registers. */
|
||||||
#endif /* configTOTAL_MPU_REGIONS == 16 */
|
#endif /* configTOTAL_MPU_REGIONS == 16 */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r1, xMPUCTRLConst \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
" ldr r1, =0xe000ed94 \n" /* r1 = 0xe000ed94 [Location of MPU_CTRL]. */
|
||||||
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
" ldr r2, [r1] \n" /* Read the value of MPU_CTRL. */
|
||||||
" orr r2, #1 \n" /* r2 = r2 | 1 i.e. Set the bit 0 in r2. */
|
" orr r2, #1 \n" /* r2 = r2 | 1 i.e. Set the bit 0 in r2. */
|
||||||
" str r2, [r1] \n" /* Enable MPU. */
|
" str r2, [r1] \n" /* Enable MPU. */
|
||||||
" dsb \n" /* Force memory writes before continuing. */
|
" dsb \n" /* Force memory writes before continuing. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_context: \n"
|
" restore_context: \n"
|
||||||
" ldr r2, pxCurrentTCBConst \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB.*/
|
" ldr r0, [r2] \n" /* r0 = pxCurrentTCB.*/
|
||||||
" ldr r1, [r0] \n" /* r1 = Location of saved context in TCB. */
|
" ldr r1, [r0] \n" /* r1 = Location of saved context in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
" restore_special_regs: \n"
|
" restore_special_regs: \n"
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" ldmdb r1!, {r2-r5} \n" /* Read task's dedicated PAC key from the task's context. */
|
||||||
|
" msr PAC_KEY_P_0, r2 \n" /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
" msr PAC_KEY_P_1, r3 \n"
|
||||||
|
" msr PAC_KEY_P_2, r4 \n"
|
||||||
|
" msr PAC_KEY_P_3, r5 \n"
|
||||||
|
" clrm {r2-r5} \n" /* Clear r2-r5. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
" ldmdb r1!, {r2-r4, lr} \n" /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, LR restored. */
|
" ldmdb r1!, {r2-r4, lr} \n" /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, LR restored. */
|
||||||
" msr psp, r2 \n"
|
" msr psp, r2 \n"
|
||||||
" msr psplim, r3 \n"
|
" msr psplim, r3 \n"
|
||||||
|
@ -366,13 +389,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" restore_context_done: \n"
|
" restore_context_done: \n"
|
||||||
" str r1, [r0] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
" str r1, [r0] \n" /* Save the location where the context should be saved next as the first member of TCB. */
|
||||||
" bx lr \n"
|
" bx lr \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
" pxCurrentTCBConst: .word pxCurrentTCB \n"
|
|
||||||
" xMPUCTRLConst: .word 0xe000ed94 \n"
|
|
||||||
" xMAIR0Const: .word 0xe000edc0 \n"
|
|
||||||
" xRNRConst: .word 0xe000ed98 \n"
|
|
||||||
" xRBARConst: .word 0xe000ed9c \n"
|
|
||||||
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -397,7 +413,16 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" mov r3, lr \n" /* r3 = LR/EXC_RETURN. */
|
" mov r3, lr \n" /* r3 = LR/EXC_RETURN. */
|
||||||
" stmdb r0!, {r2-r11} \n" /* Store on the stack - PSPLIM, LR and registers that are not automatically saved. */
|
" stmdb r0!, {r2-r11} \n" /* Store on the stack - PSPLIM, LR and registers that are not automatically saved. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" mrs r1, PAC_KEY_P_3 \n" /* Read task's dedicated PAC key from the PAC key registers. */
|
||||||
|
" mrs r2, PAC_KEY_P_2 \n"
|
||||||
|
" mrs r3, PAC_KEY_P_1 \n"
|
||||||
|
" mrs r4, PAC_KEY_P_0 \n"
|
||||||
|
" stmdb r0!, {r1-r4} \n" /* Store the task's dedicated PAC key on the stack. */
|
||||||
|
" clrm {r1-r4} \n" /* Clear r1-r4. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
" \n"
|
||||||
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
||||||
" str r0, [r1] \n" /* Save the new top of stack in TCB. */
|
" str r0, [r1] \n" /* Save the new top of stack in TCB. */
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -409,10 +434,19 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" mov r0, #0 \n" /* r0 = 0. */
|
" mov r0, #0 \n" /* r0 = 0. */
|
||||||
" msr basepri, r0 \n" /* Enable interrupts. */
|
" msr basepri, r0 \n" /* Enable interrupts. */
|
||||||
" \n"
|
" \n"
|
||||||
" ldr r2, pxCurrentTCBConst \n"/* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
" ldr r2, =pxCurrentTCB \n" /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
" ldr r1, [r2] \n" /* Read pxCurrentTCB. */
|
||||||
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */
|
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */
|
||||||
" \n"
|
" \n"
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
" ldmia r0!, {r2-r5} \n" /* Read task's dedicated PAC key from stack. */
|
||||||
|
" msr PAC_KEY_P_3, r2 \n" /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
" msr PAC_KEY_P_2, r3 \n"
|
||||||
|
" msr PAC_KEY_P_1, r4 \n"
|
||||||
|
" msr PAC_KEY_P_0, r5 \n"
|
||||||
|
" clrm {r2-r5} \n" /* Clear r2-r5. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
" \n"
|
||||||
" ldmia r0!, {r2-r11} \n" /* Read from stack - r2 = PSPLIM, r3 = LR and r4-r11 restored. */
|
" ldmia r0!, {r2-r11} \n" /* Read from stack - r2 = PSPLIM, r3 = LR and r4-r11 restored. */
|
||||||
" \n"
|
" \n"
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
@ -424,9 +458,6 @@ void PendSV_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" msr psplim, r2 \n" /* Restore the PSPLIM register value for the task. */
|
" msr psplim, r2 \n" /* Restore the PSPLIM register value for the task. */
|
||||||
" msr psp, r0 \n" /* Remember the new top of stack for the task. */
|
" msr psp, r0 \n" /* Remember the new top of stack for the task. */
|
||||||
" bx r3 \n"
|
" bx r3 \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"pxCurrentTCBConst: .word pxCurrentTCB \n"
|
|
||||||
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -443,7 +474,6 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
".syntax unified \n"
|
".syntax unified \n"
|
||||||
".extern vPortSVCHandler_C \n"
|
".extern vPortSVCHandler_C \n"
|
||||||
".extern vSystemCallEnter \n"
|
".extern vSystemCallEnter \n"
|
||||||
".extern vSystemCallEnter_1 \n"
|
|
||||||
".extern vSystemCallExit \n"
|
".extern vSystemCallExit \n"
|
||||||
" \n"
|
" \n"
|
||||||
"tst lr, #4 \n"
|
"tst lr, #4 \n"
|
||||||
|
@ -454,10 +484,8 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
"ldr r1, [r0, #24] \n"
|
"ldr r1, [r0, #24] \n"
|
||||||
"ldrb r2, [r1, #-2] \n"
|
"ldrb r2, [r1, #-2] \n"
|
||||||
"cmp r2, %0 \n"
|
"cmp r2, %0 \n"
|
||||||
"beq syscall_enter \n"
|
"blt syscall_enter \n"
|
||||||
"cmp r2, %1 \n"
|
"cmp r2, %1 \n"
|
||||||
"beq syscall_enter_1 \n"
|
|
||||||
"cmp r2, %2 \n"
|
|
||||||
"beq syscall_exit \n"
|
"beq syscall_exit \n"
|
||||||
"b vPortSVCHandler_C \n"
|
"b vPortSVCHandler_C \n"
|
||||||
" \n"
|
" \n"
|
||||||
|
@ -465,16 +493,12 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" mov r1, lr \n"
|
" mov r1, lr \n"
|
||||||
" b vSystemCallEnter \n"
|
" b vSystemCallEnter \n"
|
||||||
" \n"
|
" \n"
|
||||||
"syscall_enter_1: \n"
|
|
||||||
" mov r1, lr \n"
|
|
||||||
" b vSystemCallEnter_1 \n"
|
|
||||||
" \n"
|
|
||||||
"syscall_exit: \n"
|
"syscall_exit: \n"
|
||||||
" mov r1, lr \n"
|
" mov r1, lr \n"
|
||||||
" b vSystemCallExit \n"
|
" b vSystemCallExit \n"
|
||||||
" \n"
|
" \n"
|
||||||
: /* No outputs. */
|
: /* No outputs. */
|
||||||
:"i" ( portSVC_SYSTEM_CALL_ENTER ), "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT )
|
: "i" ( NUM_SYSTEM_CALLS ), "i" ( portSVC_SYSTEM_CALL_EXIT )
|
||||||
: "r0", "r1", "r2", "memory"
|
: "r0", "r1", "r2", "memory"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -491,11 +515,8 @@ void SVC_Handler( void ) /* __attribute__ (( naked )) PRIVILEGED_FUNCTION */
|
||||||
" ite eq \n"
|
" ite eq \n"
|
||||||
" mrseq r0, msp \n"
|
" mrseq r0, msp \n"
|
||||||
" mrsne r0, psp \n"
|
" mrsne r0, psp \n"
|
||||||
" ldr r1, svchandler_address_const \n"
|
" ldr r1, =vPortSVCHandler_C \n"
|
||||||
" bx r1 \n"
|
" bx r1 \n"
|
||||||
" \n"
|
|
||||||
" .align 4 \n"
|
|
||||||
"svchandler_address_const: .word vPortSVCHandler_C \n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M33"
|
#define portARCH_NAME "Cortex-M33"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -57,6 +58,13 @@
|
||||||
#include "portmacrocommon.h"
|
#include "portmacrocommon.h"
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef configENABLE_MVE
|
||||||
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Critical section management.
|
* @brief Critical section management.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M35P"
|
#define portARCH_NAME "Cortex-M35P"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -57,6 +58,13 @@
|
||||||
#include "portmacrocommon.h"
|
#include "portmacrocommon.h"
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef configENABLE_MVE
|
||||||
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Critical section management.
|
* @brief Critical section management.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M55"
|
#define portARCH_NAME "Cortex-M55"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 1
|
||||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M85"
|
#define portARCH_NAME "Cortex-M85"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 1
|
||||||
#define portDONT_DISCARD __attribute__( ( used ) )
|
#define portDONT_DISCARD __attribute__( ( used ) )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,10 +33,14 @@ the code is included in C files but excluded by the preprocessor in assembly
|
||||||
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
||||||
#include "FreeRTOSConfig.h"
|
#include "FreeRTOSConfig.h"
|
||||||
|
|
||||||
|
/* System call numbers includes. */
|
||||||
|
#include "mpu_syscall_numbers.h"
|
||||||
|
|
||||||
#ifndef configUSE_MPU_WRAPPERS_V1
|
#ifndef configUSE_MPU_WRAPPERS_V1
|
||||||
#define configUSE_MPU_WRAPPERS_V1 0
|
#define configUSE_MPU_WRAPPERS_V1 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
EXTERN pxCurrentTCB
|
EXTERN pxCurrentTCB
|
||||||
EXTERN xSecureContext
|
EXTERN xSecureContext
|
||||||
EXTERN vTaskSwitchContext
|
EXTERN vTaskSwitchContext
|
||||||
|
@ -45,7 +49,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
|
||||||
EXTERN SecureContext_LoadContext
|
EXTERN SecureContext_LoadContext
|
||||||
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
||||||
EXTERN vSystemCallEnter
|
EXTERN vSystemCallEnter
|
||||||
EXTERN vSystemCallEnter_1
|
|
||||||
EXTERN vSystemCallExit
|
EXTERN vSystemCallExit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -95,7 +98,7 @@ vResetPrivilege:
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
vPortAllocateSecureContext:
|
vPortAllocateSecureContext:
|
||||||
svc 0 /* Secure context is allocated in the supervisor call. portSVC_ALLOCATE_SECURE_CONTEXT = 0. */
|
svc 100 /* Secure context is allocated in the supervisor call. portSVC_ALLOCATE_SECURE_CONTEXT = 100. */
|
||||||
bx lr /* Return. */
|
bx lr /* Return. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -167,7 +170,6 @@ vRestoreContextOfFirstTask:
|
||||||
ldmia r2!, {r0, r3-r6} /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, r6 = LR. */
|
ldmia r2!, {r0, r3-r6} /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, r6 = LR. */
|
||||||
subs r2, #20
|
subs r2, #20
|
||||||
msr psp, r3
|
msr psp, r3
|
||||||
msr psplim, r4
|
|
||||||
msr control, r5
|
msr control, r5
|
||||||
mov lr, r6
|
mov lr, r6
|
||||||
ldr r4, =xSecureContext /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
ldr r4, =xSecureContext /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
|
@ -203,7 +205,6 @@ vRestoreContextOfFirstTask:
|
||||||
ldm r0!, {r1-r3} /* Read from stack - r1 = xSecureContext, r2 = PSPLIM and r3 = EXC_RETURN. */
|
ldm r0!, {r1-r3} /* Read from stack - r1 = xSecureContext, r2 = PSPLIM and r3 = EXC_RETURN. */
|
||||||
ldr r4, =xSecureContext
|
ldr r4, =xSecureContext
|
||||||
str r1, [r4] /* Set xSecureContext to this task's value for the same. */
|
str r1, [r4] /* Set xSecureContext to this task's value for the same. */
|
||||||
msr psplim, r2 /* Set this task's PSPLIM value. */
|
|
||||||
movs r1, #2 /* r1 = 2. */
|
movs r1, #2 /* r1 = 2. */
|
||||||
msr CONTROL, r1 /* Switch to use PSP in the thread mode. */
|
msr CONTROL, r1 /* Switch to use PSP in the thread mode. */
|
||||||
adds r0, #32 /* Discard everything up to r0. */
|
adds r0, #32 /* Discard everything up to r0. */
|
||||||
|
@ -230,7 +231,7 @@ vStartFirstTask:
|
||||||
cpsie i /* Globally enable interrupts. */
|
cpsie i /* Globally enable interrupts. */
|
||||||
dsb
|
dsb
|
||||||
isb
|
isb
|
||||||
svc 2 /* System call to start the first task. portSVC_START_SCHEDULER = 2. */
|
svc 102 /* System call to start the first task. portSVC_START_SCHEDULER = 102. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
ulSetInterruptMask:
|
ulSetInterruptMask:
|
||||||
|
@ -279,7 +280,7 @@ PendSV_Handler:
|
||||||
|
|
||||||
save_special_regs:
|
save_special_regs:
|
||||||
mrs r3, psp /* r3 = PSP. */
|
mrs r3, psp /* r3 = PSP. */
|
||||||
mrs r4, psplim /* r4 = PSPLIM. */
|
movs r4, #0 /* r4 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
mrs r5, control /* r5 = CONTROL. */
|
mrs r5, control /* r5 = CONTROL. */
|
||||||
mov r6, lr /* r6 = LR. */
|
mov r6, lr /* r6 = LR. */
|
||||||
stmia r2!, {r0, r3-r6} /* Store xSecureContext, original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
stmia r2!, {r0, r3-r6} /* Store xSecureContext, original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
||||||
|
@ -347,7 +348,6 @@ PendSV_Handler:
|
||||||
ldmia r2!, {r0, r3-r6} /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, r6 = LR. */
|
ldmia r2!, {r0, r3-r6} /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, r6 = LR. */
|
||||||
subs r2, #20
|
subs r2, #20
|
||||||
msr psp, r3
|
msr psp, r3
|
||||||
msr psplim, r4
|
|
||||||
msr control, r5
|
msr control, r5
|
||||||
mov lr, r6
|
mov lr, r6
|
||||||
ldr r4, =xSecureContext /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
ldr r4, =xSecureContext /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
|
@ -406,7 +406,7 @@ PendSV_Handler:
|
||||||
|
|
||||||
subs r2, r2, #12 /* Make space for xSecureContext, PSPLIM and LR on the stack. */
|
subs r2, r2, #12 /* Make space for xSecureContext, PSPLIM and LR on the stack. */
|
||||||
str r2, [r1] /* Save the new top of stack in TCB. */
|
str r2, [r1] /* Save the new top of stack in TCB. */
|
||||||
mrs r1, psplim /* r1 = PSPLIM. */
|
movs r1, #0 /* r1 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
||||||
stmia r2!, {r0, r1, r3} /* Store xSecureContext, PSPLIM and LR on the stack. */
|
stmia r2!, {r0, r1, r3} /* Store xSecureContext, PSPLIM and LR on the stack. */
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ PendSV_Handler:
|
||||||
ldr r1, [r3] /* Read pxCurrentTCB. */
|
ldr r1, [r3] /* Read pxCurrentTCB. */
|
||||||
subs r2, r2, #44 /* Make space for xSecureContext, PSPLIM, LR and the remaining registers on the stack. */
|
subs r2, r2, #44 /* Make space for xSecureContext, PSPLIM, LR and the remaining registers on the stack. */
|
||||||
str r2, [r1] /* Save the new top of stack in TCB. */
|
str r2, [r1] /* Save the new top of stack in TCB. */
|
||||||
mrs r1, psplim /* r1 = PSPLIM. */
|
movs r1, #0 /* r1 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
||||||
stmia r2!, {r0, r1, r3-r7} /* Store xSecureContext, PSPLIM, LR and the low registers that are not saved automatically. */
|
stmia r2!, {r0, r1, r3-r7} /* Store xSecureContext, PSPLIM, LR and the low registers that are not saved automatically. */
|
||||||
mov r4, r8 /* r4 = r8. */
|
mov r4, r8 /* r4 = r8. */
|
||||||
|
@ -436,7 +436,6 @@ PendSV_Handler:
|
||||||
ldr r2, [r1] /* The first item in pxCurrentTCB is the task top of stack. r2 now points to the top of stack. */
|
ldr r2, [r1] /* The first item in pxCurrentTCB is the task top of stack. r2 now points to the top of stack. */
|
||||||
|
|
||||||
ldmia r2!, {r0, r1, r4} /* Read from stack - r0 = xSecureContext, r1 = PSPLIM and r4 = LR. */
|
ldmia r2!, {r0, r1, r4} /* Read from stack - r0 = xSecureContext, r1 = PSPLIM and r4 = LR. */
|
||||||
msr psplim, r1 /* Restore the PSPLIM register value for the task. */
|
|
||||||
mov lr, r4 /* LR = r4. */
|
mov lr, r4 /* LR = r4. */
|
||||||
ldr r3, =xSecureContext /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
ldr r3, =xSecureContext /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
str r0, [r3] /* Restore the task's xSecureContext. */
|
str r0, [r3] /* Restore the task's xSecureContext. */
|
||||||
|
@ -482,21 +481,17 @@ SVC_Handler:
|
||||||
b route_svc
|
b route_svc
|
||||||
|
|
||||||
route_svc:
|
route_svc:
|
||||||
ldr r2, [r0, #24]
|
ldr r3, [r0, #24]
|
||||||
subs r2, #2
|
subs r3, #2
|
||||||
ldrb r3, [r2, #0]
|
ldrb r2, [r3, #0]
|
||||||
cmp r3, #4 /* portSVC_SYSTEM_CALL_ENTER. */
|
cmp r2, #NUM_SYSTEM_CALLS
|
||||||
beq system_call_enter
|
blt system_call_enter
|
||||||
cmp r3, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */
|
cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */
|
||||||
beq system_call_enter_1
|
|
||||||
cmp r3, #6 /* portSVC_SYSTEM_CALL_EXIT. */
|
|
||||||
beq system_call_exit
|
beq system_call_exit
|
||||||
b vPortSVCHandler_C
|
b vPortSVCHandler_C
|
||||||
|
|
||||||
system_call_enter:
|
system_call_enter:
|
||||||
b vSystemCallEnter
|
b vSystemCallEnter
|
||||||
system_call_enter_1:
|
|
||||||
b vSystemCallEnter_1
|
|
||||||
system_call_exit:
|
system_call_exit:
|
||||||
b vSystemCallExit
|
b vSystemCallExit
|
||||||
|
|
||||||
|
@ -523,7 +518,7 @@ vPortFreeSecureContext:
|
||||||
bne free_secure_context /* Branch if r1 != 0. */
|
bne free_secure_context /* Branch if r1 != 0. */
|
||||||
bx lr /* There is no secure context (xSecureContext is NULL). */
|
bx lr /* There is no secure context (xSecureContext is NULL). */
|
||||||
free_secure_context:
|
free_secure_context:
|
||||||
svc 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */
|
svc 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */
|
||||||
bx lr /* Return. */
|
bx lr /* Return. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M23"
|
#define portARCH_NAME "Cortex-M23"
|
||||||
#define portHAS_BASEPRI 0
|
#define portHAS_ARMV8M_MAIN_EXTENSION 0
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __root
|
#define portDONT_DISCARD __root
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -60,6 +61,12 @@
|
||||||
#if ( configTOTAL_MPU_REGIONS == 16 )
|
#if ( configTOTAL_MPU_REGIONS == 16 )
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
#error 16 MPU regions are not yet supported for this port.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configENABLE_MVE
|
||||||
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -32,16 +32,22 @@ the code is included in C files but excluded by the preprocessor in assembly
|
||||||
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
||||||
#include "FreeRTOSConfig.h"
|
#include "FreeRTOSConfig.h"
|
||||||
|
|
||||||
|
/* System call numbers includes. */
|
||||||
|
#include "mpu_syscall_numbers.h"
|
||||||
|
|
||||||
#ifndef configUSE_MPU_WRAPPERS_V1
|
#ifndef configUSE_MPU_WRAPPERS_V1
|
||||||
#define configUSE_MPU_WRAPPERS_V1 0
|
#define configUSE_MPU_WRAPPERS_V1 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configRUN_FREERTOS_SECURE_ONLY
|
||||||
|
#define configRUN_FREERTOS_SECURE_ONLY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
EXTERN pxCurrentTCB
|
EXTERN pxCurrentTCB
|
||||||
EXTERN vTaskSwitchContext
|
EXTERN vTaskSwitchContext
|
||||||
EXTERN vPortSVCHandler_C
|
EXTERN vPortSVCHandler_C
|
||||||
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
||||||
EXTERN vSystemCallEnter
|
EXTERN vSystemCallEnter
|
||||||
EXTERN vSystemCallEnter_1
|
|
||||||
EXTERN vSystemCallExit
|
EXTERN vSystemCallExit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -157,7 +163,9 @@ vRestoreContextOfFirstTask:
|
||||||
ldmia r1!, {r2-r5} /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, r5 = LR. */
|
ldmia r1!, {r2-r5} /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, r5 = LR. */
|
||||||
subs r1, #16
|
subs r1, #16
|
||||||
msr psp, r2
|
msr psp, r2
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
msr psplim, r3
|
msr psplim, r3
|
||||||
|
#endif
|
||||||
msr control, r4
|
msr control, r4
|
||||||
mov lr, r5
|
mov lr, r5
|
||||||
|
|
||||||
|
@ -189,7 +197,9 @@ vRestoreContextOfFirstTask:
|
||||||
ldr r0, [r1] /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
ldr r0, [r1] /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
||||||
|
|
||||||
ldm r0!, {r1-r2} /* Read from stack - r1 = PSPLIM and r2 = EXC_RETURN. */
|
ldm r0!, {r1-r2} /* Read from stack - r1 = PSPLIM and r2 = EXC_RETURN. */
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
msr psplim, r1 /* Set this task's PSPLIM value. */
|
msr psplim, r1 /* Set this task's PSPLIM value. */
|
||||||
|
#endif
|
||||||
movs r1, #2 /* r1 = 2. */
|
movs r1, #2 /* r1 = 2. */
|
||||||
msr CONTROL, r1 /* Switch to use PSP in the thread mode. */
|
msr CONTROL, r1 /* Switch to use PSP in the thread mode. */
|
||||||
adds r0, #32 /* Discard everything up to r0. */
|
adds r0, #32 /* Discard everything up to r0. */
|
||||||
|
@ -216,7 +226,7 @@ vStartFirstTask:
|
||||||
cpsie i /* Globally enable interrupts. */
|
cpsie i /* Globally enable interrupts. */
|
||||||
dsb
|
dsb
|
||||||
isb
|
isb
|
||||||
svc 2 /* System call to start the first task. portSVC_START_SCHEDULER = 2. */
|
svc 102 /* System call to start the first task. portSVC_START_SCHEDULER = 102. */
|
||||||
nop
|
nop
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -253,7 +263,11 @@ PendSV_Handler:
|
||||||
|
|
||||||
save_special_regs:
|
save_special_regs:
|
||||||
mrs r2, psp /* r2 = PSP. */
|
mrs r2, psp /* r2 = PSP. */
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
mrs r3, psplim /* r3 = PSPLIM. */
|
mrs r3, psplim /* r3 = PSPLIM. */
|
||||||
|
#else
|
||||||
|
movs r3, #0 /* r3 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
|
#endif
|
||||||
mrs r4, control /* r4 = CONTROL. */
|
mrs r4, control /* r4 = CONTROL. */
|
||||||
mov r5, lr /* r5 = LR. */
|
mov r5, lr /* r5 = LR. */
|
||||||
stmia r1!, {r2-r5} /* Store original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
stmia r1!, {r2-r5} /* Store original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
||||||
|
@ -321,7 +335,9 @@ PendSV_Handler:
|
||||||
ldmia r1!, {r2-r5} /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, r5 = LR. */
|
ldmia r1!, {r2-r5} /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, r5 = LR. */
|
||||||
subs r1, #16
|
subs r1, #16
|
||||||
msr psp, r2
|
msr psp, r2
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
msr psplim, r3
|
msr psplim, r3
|
||||||
|
#endif
|
||||||
msr control, r4
|
msr control, r4
|
||||||
mov lr, r5
|
mov lr, r5
|
||||||
|
|
||||||
|
@ -354,7 +370,11 @@ PendSV_Handler:
|
||||||
|
|
||||||
subs r0, r0, #40 /* Make space for PSPLIM, LR and the remaining registers on the stack. */
|
subs r0, r0, #40 /* Make space for PSPLIM, LR and the remaining registers on the stack. */
|
||||||
str r0, [r1] /* Save the new top of stack in TCB. */
|
str r0, [r1] /* Save the new top of stack in TCB. */
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
mrs r2, psplim /* r2 = PSPLIM. */
|
mrs r2, psplim /* r2 = PSPLIM. */
|
||||||
|
#else
|
||||||
|
movs r2, #0 /* r0 = 0. 0 is stored in the PSPLIM slot. */
|
||||||
|
#endif
|
||||||
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
||||||
stmia r0!, {r2-r7} /* Store on the stack - PSPLIM, LR and low registers that are not automatically saved. */
|
stmia r0!, {r2-r7} /* Store on the stack - PSPLIM, LR and low registers that are not automatically saved. */
|
||||||
mov r4, r8 /* r4 = r8. */
|
mov r4, r8 /* r4 = r8. */
|
||||||
|
@ -380,7 +400,9 @@ PendSV_Handler:
|
||||||
msr psp, r0 /* Remember the new top of stack for the task. */
|
msr psp, r0 /* Remember the new top of stack for the task. */
|
||||||
subs r0, r0, #40 /* Move to the starting of the saved context. */
|
subs r0, r0, #40 /* Move to the starting of the saved context. */
|
||||||
ldmia r0!, {r2-r7} /* Read from stack - r2 = PSPLIM, r3 = LR and r4-r7 restored. */
|
ldmia r0!, {r2-r7} /* Read from stack - r2 = PSPLIM, r3 = LR and r4-r7 restored. */
|
||||||
|
#if ( configRUN_FREERTOS_SECURE_ONLY == 1 )
|
||||||
msr psplim, r2 /* Restore the PSPLIM register value for the task. */
|
msr psplim, r2 /* Restore the PSPLIM register value for the task. */
|
||||||
|
#endif
|
||||||
bx r3
|
bx r3
|
||||||
|
|
||||||
#endif /* configENABLE_MPU */
|
#endif /* configENABLE_MPU */
|
||||||
|
@ -401,21 +423,17 @@ SVC_Handler:
|
||||||
b route_svc
|
b route_svc
|
||||||
|
|
||||||
route_svc:
|
route_svc:
|
||||||
ldr r2, [r0, #24]
|
ldr r3, [r0, #24]
|
||||||
subs r2, #2
|
subs r3, #2
|
||||||
ldrb r3, [r2, #0]
|
ldrb r2, [r3, #0]
|
||||||
cmp r3, #4 /* portSVC_SYSTEM_CALL_ENTER. */
|
cmp r2, #NUM_SYSTEM_CALLS
|
||||||
beq system_call_enter
|
blt system_call_enter
|
||||||
cmp r3, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */
|
cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */
|
||||||
beq system_call_enter_1
|
|
||||||
cmp r3, #6 /* portSVC_SYSTEM_CALL_EXIT. */
|
|
||||||
beq system_call_exit
|
beq system_call_exit
|
||||||
b vPortSVCHandler_C
|
b vPortSVCHandler_C
|
||||||
|
|
||||||
system_call_enter:
|
system_call_enter:
|
||||||
b vSystemCallEnter
|
b vSystemCallEnter
|
||||||
system_call_enter_1:
|
|
||||||
b vSystemCallEnter_1
|
|
||||||
system_call_exit:
|
system_call_exit:
|
||||||
b vSystemCallExit
|
b vSystemCallExit
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M23"
|
#define portARCH_NAME "Cortex-M23"
|
||||||
#define portHAS_BASEPRI 0
|
#define portHAS_ARMV8M_MAIN_EXTENSION 0
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __root
|
#define portDONT_DISCARD __root
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -60,6 +61,12 @@
|
||||||
#if ( configTOTAL_MPU_REGIONS == 16 )
|
#if ( configTOTAL_MPU_REGIONS == 16 )
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
#error 16 MPU regions are not yet supported for this port.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configENABLE_MVE
|
||||||
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M23.
|
||||||
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
* Copyright 2024 Arm Limited and/or its affiliates
|
||||||
|
* <open-source-office@arm.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -32,6 +34,9 @@ the code is included in C files but excluded by the preprocessor in assembly
|
||||||
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
||||||
#include "FreeRTOSConfig.h"
|
#include "FreeRTOSConfig.h"
|
||||||
|
|
||||||
|
/* System call numbers includes. */
|
||||||
|
#include "mpu_syscall_numbers.h"
|
||||||
|
|
||||||
#ifndef configUSE_MPU_WRAPPERS_V1
|
#ifndef configUSE_MPU_WRAPPERS_V1
|
||||||
#define configUSE_MPU_WRAPPERS_V1 0
|
#define configUSE_MPU_WRAPPERS_V1 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,7 +49,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
|
||||||
EXTERN SecureContext_LoadContext
|
EXTERN SecureContext_LoadContext
|
||||||
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
||||||
EXTERN vSystemCallEnter
|
EXTERN vSystemCallEnter
|
||||||
EXTERN vSystemCallEnter_1
|
|
||||||
EXTERN vSystemCallExit
|
EXTERN vSystemCallExit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -86,7 +90,7 @@ vResetPrivilege:
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
vPortAllocateSecureContext:
|
vPortAllocateSecureContext:
|
||||||
svc 0 /* Secure context is allocated in the supervisor call. portSVC_ALLOCATE_SECURE_CONTEXT = 0. */
|
svc 100 /* Secure context is allocated in the supervisor call. portSVC_ALLOCATE_SECURE_CONTEXT = 100. */
|
||||||
bx lr /* Return. */
|
bx lr /* Return. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -148,6 +152,14 @@ vRestoreContextOfFirstTask:
|
||||||
ldr r2, [r1] /* r2 = Location of saved context in TCB. */
|
ldr r2, [r1] /* r2 = Location of saved context in TCB. */
|
||||||
|
|
||||||
restore_special_regs_first_task:
|
restore_special_regs_first_task:
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
ldmdb r2!, {r3-r6} /* Read task's dedicated PAC key from the task's context. */
|
||||||
|
msr PAC_KEY_P_0, r3 /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
msr PAC_KEY_P_1, r4
|
||||||
|
msr PAC_KEY_P_2, r5
|
||||||
|
msr PAC_KEY_P_3, r6
|
||||||
|
clrm {r3-r6} /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
ldmdb r2!, {r0, r3-r5, lr} /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, LR restored. */
|
ldmdb r2!, {r0, r3-r5, lr} /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, LR restored. */
|
||||||
msr psp, r3
|
msr psp, r3
|
||||||
msr psplim, r4
|
msr psplim, r4
|
||||||
|
@ -173,12 +185,22 @@ vRestoreContextOfFirstTask:
|
||||||
ldr r3, [r2] /* Read pxCurrentTCB. */
|
ldr r3, [r2] /* Read pxCurrentTCB. */
|
||||||
ldr r0, [r3] /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
ldr r0, [r3] /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
||||||
|
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
ldmia r0!, {r1-r4} /* Read task's dedicated PAC key from stack. */
|
||||||
|
msr PAC_KEY_P_3, r1 /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
msr PAC_KEY_P_2, r2
|
||||||
|
msr PAC_KEY_P_1, r3
|
||||||
|
msr PAC_KEY_P_0, r4
|
||||||
|
clrm {r1-r4} /* Clear r1-r4. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
|
||||||
ldm r0!, {r1-r3} /* Read from stack - r1 = xSecureContext, r2 = PSPLIM and r3 = EXC_RETURN. */
|
ldm r0!, {r1-r3} /* Read from stack - r1 = xSecureContext, r2 = PSPLIM and r3 = EXC_RETURN. */
|
||||||
ldr r4, =xSecureContext
|
ldr r4, =xSecureContext
|
||||||
str r1, [r4] /* Set xSecureContext to this task's value for the same. */
|
str r1, [r4] /* Set xSecureContext to this task's value for the same. */
|
||||||
msr psplim, r2 /* Set this task's PSPLIM value. */
|
msr psplim, r2 /* Set this task's PSPLIM value. */
|
||||||
movs r1, #2 /* r1 = 2. */
|
mrs r1, control /* Obtain current control register value. */
|
||||||
msr CONTROL, r1 /* Switch to use PSP in the thread mode. */
|
orrs r1, r1, #2 /* r1 = r1 | 0x2 - Set the second bit to use the program stack pointe (PSP). */
|
||||||
|
msr control, r1 /* Write back the new control register value. */
|
||||||
adds r0, #32 /* Discard everything up to r0. */
|
adds r0, #32 /* Discard everything up to r0. */
|
||||||
msr psp, r0 /* This is now the new top of stack to use in the task. */
|
msr psp, r0 /* This is now the new top of stack to use in the task. */
|
||||||
isb
|
isb
|
||||||
|
@ -205,7 +227,7 @@ vStartFirstTask:
|
||||||
cpsie f
|
cpsie f
|
||||||
dsb
|
dsb
|
||||||
isb
|
isb
|
||||||
svc 2 /* System call to start the first task. portSVC_START_SCHEDULER = 2. */
|
svc 102 /* System call to start the first task. portSVC_START_SCHEDULER = 102. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
ulSetInterruptMask:
|
ulSetInterruptMask:
|
||||||
|
@ -266,6 +288,15 @@ PendSV_Handler:
|
||||||
mrs r4, psplim /* r4 = PSPLIM. */
|
mrs r4, psplim /* r4 = PSPLIM. */
|
||||||
mrs r5, control /* r5 = CONTROL. */
|
mrs r5, control /* r5 = CONTROL. */
|
||||||
stmia r2!, {r0, r3-r5, lr} /* Store xSecureContext, original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
stmia r2!, {r0, r3-r5, lr} /* Store xSecureContext, original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
mrs r3, PAC_KEY_P_0 /* Read task's dedicated PAC key from the PAC key registers. */
|
||||||
|
mrs r4, PAC_KEY_P_1
|
||||||
|
mrs r5, PAC_KEY_P_2
|
||||||
|
mrs r6, PAC_KEY_P_3
|
||||||
|
stmia r2!, {r3-r6} /* Store the task's dedicated PAC key on the task's context. */
|
||||||
|
clrm {r3-r6} /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
|
||||||
str r2, [r1] /* Save the location from where the context should be restored as the first member of TCB. */
|
str r2, [r1] /* Save the location from where the context should be restored as the first member of TCB. */
|
||||||
|
|
||||||
select_next_task:
|
select_next_task:
|
||||||
|
@ -324,6 +355,14 @@ PendSV_Handler:
|
||||||
ldr r2, [r1] /* r2 = Location of saved context in TCB. */
|
ldr r2, [r1] /* r2 = Location of saved context in TCB. */
|
||||||
|
|
||||||
restore_special_regs:
|
restore_special_regs:
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
ldmdb r2!, {r3-r6} /* Read task's dedicated PAC key from the task's context. */
|
||||||
|
msr PAC_KEY_P_0, r3 /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
msr PAC_KEY_P_1, r4
|
||||||
|
msr PAC_KEY_P_2, r5
|
||||||
|
msr PAC_KEY_P_3, r6
|
||||||
|
clrm {r3-r6} /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
ldmdb r2!, {r0, r3-r5, lr} /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, LR restored. */
|
ldmdb r2!, {r0, r3-r5, lr} /* r0 = xSecureContext, r3 = original PSP, r4 = PSPLIM, r5 = CONTROL, LR restored. */
|
||||||
msr psp, r3
|
msr psp, r3
|
||||||
msr psplim, r4
|
msr psplim, r4
|
||||||
|
@ -369,38 +408,37 @@ PendSV_Handler:
|
||||||
mrs r2, psp /* Read PSP in r2. */
|
mrs r2, psp /* Read PSP in r2. */
|
||||||
|
|
||||||
cbz r0, save_ns_context /* No secure context to save. */
|
cbz r0, save_ns_context /* No secure context to save. */
|
||||||
push {r0-r2, r14}
|
save_s_context:
|
||||||
|
push {r0-r2, lr}
|
||||||
bl SecureContext_SaveContext /* Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
bl SecureContext_SaveContext /* Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
||||||
pop {r0-r3} /* LR is now in r3. */
|
pop {r0-r2, lr}
|
||||||
mov lr, r3 /* LR = r3. */
|
|
||||||
lsls r1, r3, #25 /* r1 = r3 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
|
||||||
bpl save_ns_context /* bpl - branch if positive or zero. If r1 >= 0 ==> Bit[6] in EXC_RETURN is 0 i.e. non-secure stack was used. */
|
|
||||||
|
|
||||||
ldr r3, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
|
||||||
ldr r1, [r3] /* Read pxCurrentTCB. */
|
|
||||||
subs r2, r2, #12 /* Make space for xSecureContext, PSPLIM and LR on the stack. */
|
|
||||||
str r2, [r1] /* Save the new top of stack in TCB. */
|
|
||||||
mrs r1, psplim /* r1 = PSPLIM. */
|
|
||||||
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
|
||||||
stmia r2!, {r0, r1, r3} /* Store xSecureContext, PSPLIM and LR on the stack. */
|
|
||||||
b select_next_task
|
|
||||||
|
|
||||||
save_ns_context:
|
save_ns_context:
|
||||||
ldr r3, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
mov r3, lr /* r3 = LR. */
|
||||||
ldr r1, [r3] /* Read pxCurrentTCB. */
|
lsls r3, r3, #25 /* r3 = r3 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
||||||
|
bmi save_special_regs /* If r3 < 0 ==> Bit[6] in EXC_RETURN is 1 ==> secure stack was used. */
|
||||||
|
|
||||||
|
save_general_regs:
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
tst lr, #0x10 /* Test Bit[4] in LR. Bit[4] of EXC_RETURN is 0 if the Extended Stack Frame is in use. */
|
tst lr, #0x10 /* Test Bit[4] in LR. Bit[4] of EXC_RETURN is 0 if the Extended Stack Frame is in use. */
|
||||||
it eq
|
it eq
|
||||||
vstmdbeq r2!, {s16-s31} /* Store the additional FP context registers which are not saved automatically. */
|
vstmdbeq r2!, {s16-s31} /* Store the additional FP context registers which are not saved automatically. */
|
||||||
#endif /* configENABLE_FPU || configENABLE_MVE */
|
#endif /* configENABLE_FPU || configENABLE_MVE */
|
||||||
subs r2, r2, #44 /* Make space for xSecureContext, PSPLIM, LR and the remaining registers on the stack. */
|
stmdb r2!, {r4-r11} /* Store the registers that are not saved automatically. */
|
||||||
|
|
||||||
|
save_special_regs:
|
||||||
|
mrs r3, psplim /* r3 = PSPLIM. */
|
||||||
|
stmdb r2!, {r0, r3, lr} /* Store xSecureContext, PSPLIM and LR on the stack. */
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
mrs r3, PAC_KEY_P_3 /* Read task's dedicated PAC key from the PAC key registers. */
|
||||||
|
mrs r4, PAC_KEY_P_2
|
||||||
|
mrs r5, PAC_KEY_P_1
|
||||||
|
mrs r6, PAC_KEY_P_0
|
||||||
|
stmdb r2!, {r3-r6} /* Store the task's dedicated PAC key on the stack. */
|
||||||
|
clrm {r3-r6} /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
|
||||||
str r2, [r1] /* Save the new top of stack in TCB. */
|
str r2, [r1] /* Save the new top of stack in TCB. */
|
||||||
adds r2, r2, #12 /* r2 = r2 + 12. */
|
|
||||||
stm r2, {r4-r11} /* Store the registers that are not saved automatically. */
|
|
||||||
mrs r1, psplim /* r1 = PSPLIM. */
|
|
||||||
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
|
||||||
subs r2, r2, #12 /* r2 = r2 - 12. */
|
|
||||||
stmia r2!, {r0, r1, r3} /* Store xSecureContext, PSPLIM and LR on the stack. */
|
|
||||||
|
|
||||||
select_next_task:
|
select_next_task:
|
||||||
mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY
|
mov r0, #configMAX_SYSCALL_INTERRUPT_PRIORITY
|
||||||
|
@ -411,34 +449,45 @@ PendSV_Handler:
|
||||||
mov r0, #0 /* r0 = 0. */
|
mov r0, #0 /* r0 = 0. */
|
||||||
msr basepri, r0 /* Enable interrupts. */
|
msr basepri, r0 /* Enable interrupts. */
|
||||||
|
|
||||||
|
restore_context:
|
||||||
ldr r3, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
ldr r3, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
ldr r1, [r3] /* Read pxCurrentTCB. */
|
ldr r1, [r3] /* Read pxCurrentTCB. */
|
||||||
ldr r2, [r1] /* The first item in pxCurrentTCB is the task top of stack. r2 now points to the top of stack. */
|
ldr r2, [r1] /* The first item in pxCurrentTCB is the task top of stack. r2 now points to the top of stack. */
|
||||||
|
|
||||||
ldmia r2!, {r0, r1, r4} /* Read from stack - r0 = xSecureContext, r1 = PSPLIM and r4 = LR. */
|
restore_special_regs:
|
||||||
msr psplim, r1 /* Restore the PSPLIM register value for the task. */
|
#if ( configENABLE_PAC == 1 )
|
||||||
mov lr, r4 /* LR = r4. */
|
ldmia r2!, {r3-r6} /* Read task's dedicated PAC key from stack. */
|
||||||
|
msr PAC_KEY_P_3, r3 /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
msr PAC_KEY_P_2, r4
|
||||||
|
msr PAC_KEY_P_1, r5
|
||||||
|
msr PAC_KEY_P_0, r6
|
||||||
|
clrm {r3-r6} /* Clear r3-r6. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
ldmia r2!, {r0, r3, lr} http://files.iar.com/ftp/pub/box/bxarm-9.60.3.deb/* Read from stack - r0 = xSecureContext, r3 = PSPLIM and LR restored. */
|
||||||
|
msr psplim, r3 /* Restore the PSPLIM register value for the task. */
|
||||||
ldr r3, =xSecureContext /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
ldr r3, =xSecureContext /* Read the location of xSecureContext i.e. &( xSecureContext ). */
|
||||||
str r0, [r3] /* Restore the task's xSecureContext. */
|
str r0, [r3] /* Restore the task's xSecureContext. */
|
||||||
cbz r0, restore_ns_context /* If there is no secure context for the task, restore the non-secure context. */
|
cbz r0, restore_ns_context /* If there is no secure context for the task, restore the non-secure context. */
|
||||||
ldr r3, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
|
||||||
ldr r1, [r3] /* Read pxCurrentTCB. */
|
restore_s_context:
|
||||||
push {r2, r4}
|
push {r1-r3, lr}
|
||||||
bl SecureContext_LoadContext /* Restore the secure context. Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
bl SecureContext_LoadContext /* Restore the secure context. Params are in r0 and r1. r0 = xSecureContext and r1 = pxCurrentTCB. */
|
||||||
pop {r2, r4}
|
pop {r1-r3, lr}
|
||||||
mov lr, r4 /* LR = r4. */
|
|
||||||
lsls r1, r4, #25 /* r1 = r4 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
|
||||||
bpl restore_ns_context /* bpl - branch if positive or zero. If r1 >= 0 ==> Bit[6] in EXC_RETURN is 0 i.e. non-secure stack was used. */
|
|
||||||
msr psp, r2 /* Remember the new top of stack for the task. */
|
|
||||||
bx lr
|
|
||||||
|
|
||||||
restore_ns_context:
|
restore_ns_context:
|
||||||
|
mov r0, lr /* r0 = LR (EXC_RETURN). */
|
||||||
|
lsls r0, r0, #25 /* r0 = r0 << 25. Bit[6] of EXC_RETURN is 1 if secure stack was used, 0 if non-secure stack was used to store stack frame. */
|
||||||
|
bmi restore_context_done /* r0 < 0 ==> Bit[6] in EXC_RETURN is 1 ==> secure stack was used to store the stack frame. */
|
||||||
|
|
||||||
|
restore_general_regs:
|
||||||
ldmia r2!, {r4-r11} /* Restore the registers that are not automatically restored. */
|
ldmia r2!, {r4-r11} /* Restore the registers that are not automatically restored. */
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
tst lr, #0x10 /* Test Bit[4] in LR. Bit[4] of EXC_RETURN is 0 if the Extended Stack Frame is in use. */
|
tst lr, #0x10 /* Test Bit[4] in LR. Bit[4] of EXC_RETURN is 0 if the Extended Stack Frame is in use. */
|
||||||
it eq
|
it eq
|
||||||
vldmiaeq r2!, {s16-s31} /* Restore the additional FP context registers which are not restored automatically. */
|
vldmiaeq r2!, {s16-s31} /* Restore the additional FP context registers which are not restored automatically. */
|
||||||
#endif /* configENABLE_FPU || configENABLE_MVE */
|
#endif /* configENABLE_FPU || configENABLE_MVE */
|
||||||
|
|
||||||
|
restore_context_done:
|
||||||
msr psp, r2 /* Remember the new top of stack for the task. */
|
msr psp, r2 /* Remember the new top of stack for the task. */
|
||||||
bx lr
|
bx lr
|
||||||
|
|
||||||
|
@ -455,11 +504,9 @@ SVC_Handler:
|
||||||
|
|
||||||
ldr r1, [r0, #24]
|
ldr r1, [r0, #24]
|
||||||
ldrb r2, [r1, #-2]
|
ldrb r2, [r1, #-2]
|
||||||
cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */
|
cmp r2, #NUM_SYSTEM_CALLS
|
||||||
beq syscall_enter
|
blt syscall_enter
|
||||||
cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */
|
cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */
|
||||||
beq syscall_enter_1
|
|
||||||
cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */
|
|
||||||
beq syscall_exit
|
beq syscall_exit
|
||||||
b vPortSVCHandler_C
|
b vPortSVCHandler_C
|
||||||
|
|
||||||
|
@ -467,10 +514,6 @@ SVC_Handler:
|
||||||
mov r1, lr
|
mov r1, lr
|
||||||
b vSystemCallEnter
|
b vSystemCallEnter
|
||||||
|
|
||||||
syscall_enter_1:
|
|
||||||
mov r1, lr
|
|
||||||
b vSystemCallEnter_1
|
|
||||||
|
|
||||||
syscall_exit:
|
syscall_exit:
|
||||||
mov r1, lr
|
mov r1, lr
|
||||||
b vSystemCallExit
|
b vSystemCallExit
|
||||||
|
@ -493,7 +536,7 @@ vPortFreeSecureContext:
|
||||||
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
|
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
|
||||||
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
|
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
|
||||||
it ne
|
it ne
|
||||||
svcne 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */
|
svcne 101 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 101. */
|
||||||
bx lr /* Return. */
|
bx lr /* Return. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -49,19 +49,22 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M33"
|
#define portARCH_NAME "Cortex-M33"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __root
|
#define portDONT_DISCARD __root
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
|
||||||
#endif
|
|
||||||
/*-----------------------------------------------------------*/
|
|
||||||
|
|
||||||
/* ARMv8-M common port configurations. */
|
/* ARMv8-M common port configurations. */
|
||||||
#include "portmacrocommon.h"
|
#include "portmacrocommon.h"
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef configENABLE_MVE
|
||||||
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Critical section management.
|
* @brief Critical section management.
|
||||||
*/
|
*/
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
* Copyright 2024 Arm Limited and/or its affiliates
|
||||||
|
* <open-source-office@arm.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -32,6 +34,9 @@ the code is included in C files but excluded by the preprocessor in assembly
|
||||||
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler. */
|
||||||
#include "FreeRTOSConfig.h"
|
#include "FreeRTOSConfig.h"
|
||||||
|
|
||||||
|
/* System call numbers includes. */
|
||||||
|
#include "mpu_syscall_numbers.h"
|
||||||
|
|
||||||
#ifndef configUSE_MPU_WRAPPERS_V1
|
#ifndef configUSE_MPU_WRAPPERS_V1
|
||||||
#define configUSE_MPU_WRAPPERS_V1 0
|
#define configUSE_MPU_WRAPPERS_V1 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,7 +46,6 @@ files (__ICCARM__ is defined by the IAR C compiler but not by the IAR assembler.
|
||||||
EXTERN vPortSVCHandler_C
|
EXTERN vPortSVCHandler_C
|
||||||
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
#if ( ( configENABLE_MPU == 1 ) && ( configUSE_MPU_WRAPPERS_V1 == 0 ) )
|
||||||
EXTERN vSystemCallEnter
|
EXTERN vSystemCallEnter
|
||||||
EXTERN vSystemCallEnter_1
|
|
||||||
EXTERN vSystemCallExit
|
EXTERN vSystemCallExit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -138,6 +142,14 @@ vRestoreContextOfFirstTask:
|
||||||
ldr r1, [r0] /* r1 = Location of saved context in TCB. */
|
ldr r1, [r0] /* r1 = Location of saved context in TCB. */
|
||||||
|
|
||||||
restore_special_regs_first_task:
|
restore_special_regs_first_task:
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
ldmdb r1!, {r2-r5} /* Read task's dedicated PAC key from the task's context. */
|
||||||
|
msr PAC_KEY_P_0, r2 /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
msr PAC_KEY_P_1, r3
|
||||||
|
msr PAC_KEY_P_2, r4
|
||||||
|
msr PAC_KEY_P_3, r5
|
||||||
|
clrm {r2-r5} /* Clear r2-r5. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
ldmdb r1!, {r2-r4, lr} /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, LR restored. */
|
ldmdb r1!, {r2-r4, lr} /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, LR restored. */
|
||||||
msr psp, r2
|
msr psp, r2
|
||||||
msr psplim, r3
|
msr psplim, r3
|
||||||
|
@ -161,10 +173,20 @@ vRestoreContextOfFirstTask:
|
||||||
ldr r1, [r2] /* Read pxCurrentTCB. */
|
ldr r1, [r2] /* Read pxCurrentTCB. */
|
||||||
ldr r0, [r1] /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
ldr r0, [r1] /* Read top of stack from TCB - The first item in pxCurrentTCB is the task top of stack. */
|
||||||
|
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
ldmia r0!, {r1-r4} /* Read task's dedicated PAC key from stack. */
|
||||||
|
msr PAC_KEY_P_3, r1 /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
msr PAC_KEY_P_2, r2
|
||||||
|
msr PAC_KEY_P_1, r3
|
||||||
|
msr PAC_KEY_P_0, r4
|
||||||
|
clrm {r1-r4} /* Clear r1-r4. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
|
||||||
ldm r0!, {r1-r2} /* Read from stack - r1 = PSPLIM and r2 = EXC_RETURN. */
|
ldm r0!, {r1-r2} /* Read from stack - r1 = PSPLIM and r2 = EXC_RETURN. */
|
||||||
msr psplim, r1 /* Set this task's PSPLIM value. */
|
msr psplim, r1 /* Set this task's PSPLIM value. */
|
||||||
movs r1, #2 /* r1 = 2. */
|
mrs r1, control /* Obtain current control register value. */
|
||||||
msr CONTROL, r1 /* Switch to use PSP in the thread mode. */
|
orrs r1, r1, #2 /* r1 = r1 | 0x2 - Set the second bit to use the program stack pointe (PSP). */
|
||||||
|
msr control, r1 /* Write back the new control register value. */
|
||||||
adds r0, #32 /* Discard everything up to r0. */
|
adds r0, #32 /* Discard everything up to r0. */
|
||||||
msr psp, r0 /* This is now the new top of stack to use in the task. */
|
msr psp, r0 /* This is now the new top of stack to use in the task. */
|
||||||
isb
|
isb
|
||||||
|
@ -191,7 +213,7 @@ vStartFirstTask:
|
||||||
cpsie f
|
cpsie f
|
||||||
dsb
|
dsb
|
||||||
isb
|
isb
|
||||||
svc 2 /* System call to start the first task. portSVC_START_SCHEDULER = 2. */
|
svc 102 /* System call to start the first task. portSVC_START_SCHEDULER = 102. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
ulSetInterruptMask:
|
ulSetInterruptMask:
|
||||||
|
@ -228,7 +250,6 @@ PendSV_Handler:
|
||||||
vstmiaeq r1!, {s0-s16} /* Store hardware saved FP context. */
|
vstmiaeq r1!, {s0-s16} /* Store hardware saved FP context. */
|
||||||
sub r2, r2, #0x20 /* Set r2 back to the location of hardware saved context. */
|
sub r2, r2, #0x20 /* Set r2 back to the location of hardware saved context. */
|
||||||
#endif /* configENABLE_FPU || configENABLE_MVE */
|
#endif /* configENABLE_FPU || configENABLE_MVE */
|
||||||
|
|
||||||
stmia r1!, {r4-r11} /* Store r4-r11. */
|
stmia r1!, {r4-r11} /* Store r4-r11. */
|
||||||
ldmia r2, {r4-r11} /* Copy the hardware saved context into r4-r11. */
|
ldmia r2, {r4-r11} /* Copy the hardware saved context into r4-r11. */
|
||||||
stmia r1!, {r4-r11} /* Store the hardware saved context. */
|
stmia r1!, {r4-r11} /* Store the hardware saved context. */
|
||||||
|
@ -237,6 +258,15 @@ PendSV_Handler:
|
||||||
mrs r3, psplim /* r3 = PSPLIM. */
|
mrs r3, psplim /* r3 = PSPLIM. */
|
||||||
mrs r4, control /* r4 = CONTROL. */
|
mrs r4, control /* r4 = CONTROL. */
|
||||||
stmia r1!, {r2-r4, lr} /* Store original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
stmia r1!, {r2-r4, lr} /* Store original PSP (after hardware has saved context), PSPLIM, CONTROL and LR. */
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
mrs r2, PAC_KEY_P_0 /* Read task's dedicated PAC key from the PAC key registers. */
|
||||||
|
mrs r3, PAC_KEY_P_1
|
||||||
|
mrs r4, PAC_KEY_P_2
|
||||||
|
mrs r5, PAC_KEY_P_3
|
||||||
|
stmia r1!, {r2-r5} /* Store the task's dedicated PAC key on the task's context. */
|
||||||
|
clrm {r2-r5} /* Clear r2-r5. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
|
||||||
str r1, [r0] /* Save the location from where the context should be restored as the first member of TCB. */
|
str r1, [r0] /* Save the location from where the context should be restored as the first member of TCB. */
|
||||||
|
|
||||||
select_next_task:
|
select_next_task:
|
||||||
|
@ -295,6 +325,14 @@ PendSV_Handler:
|
||||||
ldr r1, [r0] /* r1 = Location of saved context in TCB. */
|
ldr r1, [r0] /* r1 = Location of saved context in TCB. */
|
||||||
|
|
||||||
restore_special_regs:
|
restore_special_regs:
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
ldmdb r1!, {r2-r5} /* Read task's dedicated PAC key from the task's context. */
|
||||||
|
msr PAC_KEY_P_0, r2 /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
msr PAC_KEY_P_1, r3
|
||||||
|
msr PAC_KEY_P_2, r4
|
||||||
|
msr PAC_KEY_P_3, r5
|
||||||
|
clrm {r2-r5} /* Clear r2-r5. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
ldmdb r1!, {r2-r4, lr} /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, LR restored. */
|
ldmdb r1!, {r2-r4, lr} /* r2 = original PSP, r3 = PSPLIM, r4 = CONTROL, LR restored. */
|
||||||
msr psp, r2
|
msr psp, r2
|
||||||
msr psplim, r3
|
msr psplim, r3
|
||||||
|
@ -330,6 +368,15 @@ PendSV_Handler:
|
||||||
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
mov r3, lr /* r3 = LR/EXC_RETURN. */
|
||||||
stmdb r0!, {r2-r11} /* Store on the stack - PSPLIM, LR and registers that are not automatically. */
|
stmdb r0!, {r2-r11} /* Store on the stack - PSPLIM, LR and registers that are not automatically. */
|
||||||
|
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
mrs r1, PAC_KEY_P_3 /* Read task's dedicated PAC key from the PAC key registers. */
|
||||||
|
mrs r2, PAC_KEY_P_2
|
||||||
|
mrs r3, PAC_KEY_P_1
|
||||||
|
mrs r4, PAC_KEY_P_0
|
||||||
|
stmdb r0!, {r1-r4} /* Store the task's dedicated PAC key on the stack. */
|
||||||
|
clrm {r1-r4} /* Clear r1-r4. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
|
||||||
ldr r2, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
ldr r2, =pxCurrentTCB /* Read the location of pxCurrentTCB i.e. &( pxCurrentTCB ). */
|
||||||
ldr r1, [r2] /* Read pxCurrentTCB. */
|
ldr r1, [r2] /* Read pxCurrentTCB. */
|
||||||
str r0, [r1] /* Save the new top of stack in TCB. */
|
str r0, [r1] /* Save the new top of stack in TCB. */
|
||||||
|
@ -346,6 +393,15 @@ PendSV_Handler:
|
||||||
ldr r1, [r2] /* Read pxCurrentTCB. */
|
ldr r1, [r2] /* Read pxCurrentTCB. */
|
||||||
ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */
|
ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. r0 now points to the top of stack. */
|
||||||
|
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
ldmia r0!, {r2-r5} /* Read task's dedicated PAC key from stack. */
|
||||||
|
msr PAC_KEY_P_3, r2 /* Write the task's dedicated PAC key to the PAC key registers. */
|
||||||
|
msr PAC_KEY_P_2, r3
|
||||||
|
msr PAC_KEY_P_1, r4
|
||||||
|
msr PAC_KEY_P_0, r5
|
||||||
|
clrm {r2-r5} /* Clear r2-r5. */
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
|
|
||||||
ldmia r0!, {r2-r11} /* Read from stack - r2 = PSPLIM, r3 = LR and r4-r11 restored. */
|
ldmia r0!, {r2-r11} /* Read from stack - r2 = PSPLIM, r3 = LR and r4-r11 restored. */
|
||||||
|
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
@ -371,11 +427,9 @@ SVC_Handler:
|
||||||
|
|
||||||
ldr r1, [r0, #24]
|
ldr r1, [r0, #24]
|
||||||
ldrb r2, [r1, #-2]
|
ldrb r2, [r1, #-2]
|
||||||
cmp r2, #4 /* portSVC_SYSTEM_CALL_ENTER. */
|
cmp r2, #NUM_SYSTEM_CALLS
|
||||||
beq syscall_enter
|
blt syscall_enter
|
||||||
cmp r2, #5 /* portSVC_SYSTEM_CALL_ENTER_1. */
|
cmp r2, #104 /* portSVC_SYSTEM_CALL_EXIT. */
|
||||||
beq syscall_enter_1
|
|
||||||
cmp r2, #6 /* portSVC_SYSTEM_CALL_EXIT. */
|
|
||||||
beq syscall_exit
|
beq syscall_exit
|
||||||
b vPortSVCHandler_C
|
b vPortSVCHandler_C
|
||||||
|
|
||||||
|
@ -383,10 +437,6 @@ SVC_Handler:
|
||||||
mov r1, lr
|
mov r1, lr
|
||||||
b vSystemCallEnter
|
b vSystemCallEnter
|
||||||
|
|
||||||
syscall_enter_1:
|
|
||||||
mov r1, lr
|
|
||||||
b vSystemCallEnter_1
|
|
||||||
|
|
||||||
syscall_exit:
|
syscall_exit:
|
||||||
mov r1, lr
|
mov r1, lr
|
||||||
b vSystemCallExit
|
b vSystemCallExit
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M33"
|
#define portARCH_NAME "Cortex-M33"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __root
|
#define portDONT_DISCARD __root
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -57,8 +58,10 @@
|
||||||
#include "portmacrocommon.h"
|
#include "portmacrocommon.h"
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
#ifndef configENABLE_MVE
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M33.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M35P"
|
#define portARCH_NAME "Cortex-M35P"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 0
|
||||||
#define portDONT_DISCARD __root
|
#define portDONT_DISCARD __root
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -57,8 +58,10 @@
|
||||||
#include "portmacrocommon.h"
|
#include "portmacrocommon.h"
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
#ifndef configENABLE_MVE
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
#define configENABLE_MVE 0
|
||||||
|
#elif ( configENABLE_MVE != 0 )
|
||||||
|
#error configENABLE_MVE must be left undefined, or defined to 0 for the Cortex-M35.
|
||||||
#endif
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M55"
|
#define portARCH_NAME "Cortex-M55"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 1
|
||||||
#define portDONT_DISCARD __root
|
#define portDONT_DISCARD __root
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -62,11 +63,6 @@
|
||||||
#include "portmacrocommon.h"
|
#include "portmacrocommon.h"
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
|
||||||
#endif
|
|
||||||
/*-----------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Critical section management.
|
* @brief Critical section management.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
* Architecture specifics.
|
* Architecture specifics.
|
||||||
*/
|
*/
|
||||||
#define portARCH_NAME "Cortex-M85"
|
#define portARCH_NAME "Cortex-M85"
|
||||||
#define portHAS_BASEPRI 1
|
#define portHAS_ARMV8M_MAIN_EXTENSION 1
|
||||||
|
#define portARMV8M_MINOR_VERSION 1
|
||||||
#define portDONT_DISCARD __root
|
#define portDONT_DISCARD __root
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -62,11 +63,6 @@
|
||||||
#include "portmacrocommon.h"
|
#include "portmacrocommon.h"
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if( configTOTAL_MPU_REGIONS == 16 )
|
|
||||||
#error 16 MPU regions are not yet supported for this port.
|
|
||||||
#endif
|
|
||||||
/*-----------------------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Critical section management.
|
* @brief Critical section management.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -52,7 +52,7 @@ BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) );
|
||||||
* @brief Raises the privilege level by clearing the bit 0 of the CONTROL
|
* @brief Raises the privilege level by clearing the bit 0 of the CONTROL
|
||||||
* register.
|
* register.
|
||||||
*
|
*
|
||||||
* @note This is a privileged function and should only be called from the kenrel
|
* @note This is a privileged function and should only be called from the kernel
|
||||||
* code.
|
* code.
|
||||||
*
|
*
|
||||||
* Bit 0 of the CONTROL register defines the privilege level of Thread Mode.
|
* Bit 0 of the CONTROL register defines the privilege level of Thread Mode.
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
* Copyright 2024 Arm Limited and/or its affiliates
|
||||||
|
* <open-source-office@arm.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -125,6 +127,18 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
extern BaseType_t xIsPrivileged( void ) /* __attribute__ (( naked )) */;
|
extern BaseType_t xIsPrivileged( void ) /* __attribute__ (( naked )) */;
|
||||||
extern void vResetPrivilege( void ) /* __attribute__ (( naked )) */;
|
extern void vResetPrivilege( void ) /* __attribute__ (( naked )) */;
|
||||||
#endif /* configENABLE_MPU */
|
#endif /* configENABLE_MPU */
|
||||||
|
|
||||||
|
#if ( configENABLE_PAC == 1 )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates 128-bit task's random PAC key.
|
||||||
|
*
|
||||||
|
* @param[out] pulTaskPacKey Pointer to a 4-word (128-bits) array to be
|
||||||
|
* filled with a 128-bit random number.
|
||||||
|
*/
|
||||||
|
void vApplicationGenerateTaskRandomPacKey( uint32_t * pulTaskPacKey );
|
||||||
|
|
||||||
|
#endif /* configENABLE_PAC */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +151,7 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#define portPRIVILEGE_BIT ( 0x0UL )
|
#define portPRIVILEGE_BIT ( 0x0UL )
|
||||||
#endif /* configENABLE_MPU */
|
#endif /* configENABLE_MPU */
|
||||||
|
|
||||||
/* MPU settings that can be overriden in FreeRTOSConfig.h. */
|
/* MPU settings that can be overridden in FreeRTOSConfig.h. */
|
||||||
#ifndef configTOTAL_MPU_REGIONS
|
#ifndef configTOTAL_MPU_REGIONS
|
||||||
/* Define to 8 for backward compatibility. */
|
/* Define to 8 for backward compatibility. */
|
||||||
#define configTOTAL_MPU_REGIONS ( 8UL )
|
#define configTOTAL_MPU_REGIONS ( 8UL )
|
||||||
|
@ -223,7 +237,20 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
*/
|
*/
|
||||||
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
#if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) )
|
||||||
|
|
||||||
#if( configENABLE_TRUSTZONE == 1 )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
|
* | | | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
|
* +-----------+---------------+----------+-----------------+------------------------------+------------+-----+
|
||||||
|
*
|
||||||
|
* <-----------><--------------><---------><----------------><-----------------------------><-----------><---->
|
||||||
|
* 16 17 8 8 5 16 1
|
||||||
|
*/
|
||||||
|
#define MAX_CONTEXT_SIZE 71
|
||||||
|
|
||||||
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
|
@ -232,11 +259,24 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
* +-----------+---------------+----------+-----------------+------------------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
* <-----------><--------------><---------><----------------><-----------------------------><---->
|
||||||
* 16 16 8 8 5 1
|
* 16 17 8 8 5 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 54
|
#define MAX_CONTEXT_SIZE 55
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
|
* | s16-s31 | s0-s15, FPSCR | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
|
* | | | | PC, xPSR | EXC_RETURN | | |
|
||||||
|
* +-----------+---------------+----------+-----------------+----------------------+------------+-----+
|
||||||
|
*
|
||||||
|
* <-----------><--------------><---------><----------------><---------------------><-----------><---->
|
||||||
|
* 16 17 8 8 4 16 1
|
||||||
|
*/
|
||||||
|
#define MAX_CONTEXT_SIZE 70
|
||||||
|
|
||||||
|
#else /* if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
|
@ -245,15 +285,28 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
* +-----------+---------------+----------+-----------------+----------------------+-----+
|
||||||
*
|
*
|
||||||
* <-----------><--------------><---------><----------------><---------------------><---->
|
* <-----------><--------------><---------><----------------><---------------------><---->
|
||||||
* 16 16 8 8 4 1
|
* 16 17 8 8 4 1
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 53
|
#define MAX_CONTEXT_SIZE 54
|
||||||
|
|
||||||
#endif /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
#else /* #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
|
#else /* #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
|
||||||
|
|
||||||
#if( configENABLE_TRUSTZONE == 1 )
|
#if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
|
* | r4-r11 | r0-r3, r12, LR, | xSecureContext, PSP, PSPLIM, | TaskPacKey | |
|
||||||
|
* | | PC, xPSR | CONTROL, EXC_RETURN | | |
|
||||||
|
* +----------+-----------------+------------------------------+------------+-----+
|
||||||
|
*
|
||||||
|
* <---------><----------------><------------------------------><-----------><---->
|
||||||
|
* 8 8 5 16 1
|
||||||
|
*/
|
||||||
|
#define MAX_CONTEXT_SIZE 38
|
||||||
|
|
||||||
|
#elif ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 0 ) )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +----------+-----------------+------------------------------+-----+
|
* +----------+-----------------+------------------------------+-----+
|
||||||
|
@ -266,6 +319,19 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 22
|
#define MAX_CONTEXT_SIZE 22
|
||||||
|
|
||||||
|
#elif ( ( configENABLE_TRUSTZONE == 0 ) && ( configENABLE_PAC == 1 ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
|
* | r4-r11 | r0-r3, r12, LR, | PSP, PSPLIM, CONTROL | TaskPacKey | |
|
||||||
|
* | | PC, xPSR | EXC_RETURN | | |
|
||||||
|
* +----------+-----------------+----------------------+------------+-----+
|
||||||
|
*
|
||||||
|
* <---------><----------------><----------------------><-----------><---->
|
||||||
|
* 8 8 4 16 1
|
||||||
|
*/
|
||||||
|
#define MAX_CONTEXT_SIZE 37
|
||||||
|
|
||||||
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#else /* #if( configENABLE_TRUSTZONE == 1 ) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -279,7 +345,7 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
*/
|
*/
|
||||||
#define MAX_CONTEXT_SIZE 21
|
#define MAX_CONTEXT_SIZE 21
|
||||||
|
|
||||||
#endif /* #if( configENABLE_TRUSTZONE == 1 ) */
|
#endif /* #if ( ( configENABLE_TRUSTZONE == 1 ) && ( configENABLE_PAC == 1 ) ) */
|
||||||
|
|
||||||
#endif /* #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
|
#endif /* #if ( ( configENABLE_FPU == 1 ) || ( configENABLE_MVE == 1 ) ) */
|
||||||
|
|
||||||
|
@ -287,6 +353,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#define portSTACK_FRAME_HAS_PADDING_FLAG ( 1UL << 0UL )
|
#define portSTACK_FRAME_HAS_PADDING_FLAG ( 1UL << 0UL )
|
||||||
#define portTASK_IS_PRIVILEGED_FLAG ( 1UL << 1UL )
|
#define portTASK_IS_PRIVILEGED_FLAG ( 1UL << 1UL )
|
||||||
|
|
||||||
|
/* Size of an Access Control List (ACL) entry in bits. */
|
||||||
|
#define portACL_ENTRY_SIZE_BITS ( 32U )
|
||||||
|
|
||||||
typedef struct MPU_SETTINGS
|
typedef struct MPU_SETTINGS
|
||||||
{
|
{
|
||||||
uint32_t ulMAIR0; /**< MAIR0 for the task containing attributes for all the 4 per task regions. */
|
uint32_t ulMAIR0; /**< MAIR0 for the task containing attributes for all the 4 per task regions. */
|
||||||
|
@ -296,6 +365,9 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
|
|
||||||
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
|
||||||
xSYSTEM_CALL_STACK_INFO xSystemCallStackInfo;
|
xSYSTEM_CALL_STACK_INFO xSystemCallStackInfo;
|
||||||
|
#if ( configENABLE_ACCESS_CONTROL_LIST == 1 )
|
||||||
|
uint32_t ulAccessControlList[ ( configPROTECTED_KERNEL_OBJECT_POOL_SIZE / portACL_ENTRY_SIZE_BITS ) + 1 ];
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} xMPU_SETTINGS;
|
} xMPU_SETTINGS;
|
||||||
|
|
||||||
|
@ -306,8 +378,8 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
* @brief Validate priority of ISRs that are allowed to call FreeRTOS
|
* @brief Validate priority of ISRs that are allowed to call FreeRTOS
|
||||||
* system calls.
|
* system calls.
|
||||||
*/
|
*/
|
||||||
#ifdef configASSERT
|
#if ( configASSERT_DEFINED == 1 )
|
||||||
#if ( portHAS_BASEPRI == 1 )
|
#if ( portHAS_ARMV8M_MAIN_EXTENSION == 1 )
|
||||||
void vPortValidateInterruptPriority( void );
|
void vPortValidateInterruptPriority( void );
|
||||||
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
|
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
|
||||||
#endif
|
#endif
|
||||||
|
@ -316,24 +388,40 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
/**
|
/**
|
||||||
* @brief SVC numbers.
|
* @brief SVC numbers.
|
||||||
*/
|
*/
|
||||||
#define portSVC_ALLOCATE_SECURE_CONTEXT 0
|
#define portSVC_ALLOCATE_SECURE_CONTEXT 100
|
||||||
#define portSVC_FREE_SECURE_CONTEXT 1
|
#define portSVC_FREE_SECURE_CONTEXT 101
|
||||||
#define portSVC_START_SCHEDULER 2
|
#define portSVC_START_SCHEDULER 102
|
||||||
#define portSVC_RAISE_PRIVILEGE 3
|
#define portSVC_RAISE_PRIVILEGE 103
|
||||||
#define portSVC_SYSTEM_CALL_ENTER 4 /* System calls with upto 4 parameters. */
|
#define portSVC_SYSTEM_CALL_EXIT 104
|
||||||
#define portSVC_SYSTEM_CALL_ENTER_1 5 /* System calls with 5 parameters. */
|
#define portSVC_YIELD 105
|
||||||
#define portSVC_SYSTEM_CALL_EXIT 6
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Scheduler utilities.
|
* @brief Scheduler utilities.
|
||||||
*/
|
*/
|
||||||
|
#if ( configENABLE_MPU == 1 )
|
||||||
|
#define portYIELD() __asm volatile ( "svc %0" ::"i" ( portSVC_YIELD ) : "memory" )
|
||||||
|
#define portYIELD_WITHIN_API() vPortYield()
|
||||||
|
#else
|
||||||
#define portYIELD() vPortYield()
|
#define portYIELD() vPortYield()
|
||||||
|
#define portYIELD_WITHIN_API() vPortYield()
|
||||||
|
#endif
|
||||||
|
|
||||||
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
|
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
|
||||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
|
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
|
||||||
do { if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; } \
|
do \
|
||||||
while( 0 )
|
{ \
|
||||||
|
if( xSwitchRequired ) \
|
||||||
|
{ \
|
||||||
|
traceISR_EXIT_TO_SCHEDULER(); \
|
||||||
|
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
traceISR_EXIT(); \
|
||||||
|
} \
|
||||||
|
} while( 0 )
|
||||||
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -435,6 +523,56 @@ extern void vClearInterruptMask( uint32_t ulMask ) /* __attribute__(( naked )) P
|
||||||
#define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" )
|
#define portMEMORY_BARRIER() __asm volatile ( "" ::: "memory" )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Select correct value of configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||||
|
* based on whether or not Mainline extension is implemented. */
|
||||||
|
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||||
|
#if ( portHAS_ARMV8M_MAIN_EXTENSION == 1 )
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||||
|
#else
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||||
|
#endif
|
||||||
|
#endif /* #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Port-optimised task selection.
|
||||||
|
*/
|
||||||
|
#if ( configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Count the number of leading zeros in a 32-bit value.
|
||||||
|
*/
|
||||||
|
static portFORCE_INLINE uint32_t ulPortCountLeadingZeros( uint32_t ulBitmap )
|
||||||
|
{
|
||||||
|
uint32_t ulReturn;
|
||||||
|
|
||||||
|
__asm volatile ( "clz %0, %1" : "=r" ( ulReturn ) : "r" ( ulBitmap ) : "memory" );
|
||||||
|
|
||||||
|
return ulReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check the configuration. */
|
||||||
|
#if ( configMAX_PRIORITIES > 32 )
|
||||||
|
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 different priorities as tasks that share a priority will time slice.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( portHAS_ARMV8M_MAIN_EXTENSION == 0 )
|
||||||
|
#error ARMv8-M baseline implementations (such as Cortex-M23) do not support port-optimised task selection. Please set configUSE_PORT_OPTIMISED_TASK_SELECTION to 0 or leave it undefined.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Store/clear the ready priorities in a bit map.
|
||||||
|
*/
|
||||||
|
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
|
||||||
|
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the priority of the highest-priority task that is ready to execute.
|
||||||
|
*/
|
||||||
|
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ulPortCountLeadingZeros( ( uxReadyPriorities ) ) )
|
||||||
|
|
||||||
|
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ secureportNON_SECURE_CALLABLE void SecureContext_Init( void )
|
||||||
* securecontextNO_STACK when no secure context is loaded. */
|
* securecontextNO_STACK when no secure context is loaded. */
|
||||||
if( ( ulIPSR != 0 ) && ( pucStackLimit == securecontextNO_STACK ) )
|
if( ( ulIPSR != 0 ) && ( pucStackLimit == securecontextNO_STACK ) )
|
||||||
{
|
{
|
||||||
/* Ontain a free secure context. */
|
/* Obtain a free secure context. */
|
||||||
ulSecureContextIndex = ulGetSecureContext( pvTaskHandle );
|
ulSecureContextIndex = ulGetSecureContext( pvTaskHandle );
|
||||||
|
|
||||||
/* Were we able to get a free context? */
|
/* Were we able to get a free context? */
|
||||||
|
@ -275,7 +275,8 @@ secureportNON_SECURE_CALLABLE void SecureContext_Init( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
secureportNON_SECURE_CALLABLE void SecureContext_FreeContext( SecureContextHandle_t xSecureContextHandle, void * pvTaskHandle )
|
secureportNON_SECURE_CALLABLE void SecureContext_FreeContext( SecureContextHandle_t xSecureContextHandle,
|
||||||
|
void * pvTaskHandle )
|
||||||
{
|
{
|
||||||
uint32_t ulIPSR, ulSecureContextIndex;
|
uint32_t ulIPSR, ulSecureContextIndex;
|
||||||
|
|
||||||
|
@ -306,7 +307,8 @@ secureportNON_SECURE_CALLABLE void SecureContext_FreeContext( SecureContextHandl
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
secureportNON_SECURE_CALLABLE void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle, void * pvTaskHandle )
|
secureportNON_SECURE_CALLABLE void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle,
|
||||||
|
void * pvTaskHandle )
|
||||||
{
|
{
|
||||||
uint8_t * pucStackLimit;
|
uint8_t * pucStackLimit;
|
||||||
uint32_t ulSecureContextIndex;
|
uint32_t ulSecureContextIndex;
|
||||||
|
@ -328,7 +330,8 @@ secureportNON_SECURE_CALLABLE void SecureContext_LoadContext( SecureContextHandl
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
secureportNON_SECURE_CALLABLE void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle, void * pvTaskHandle )
|
secureportNON_SECURE_CALLABLE void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle,
|
||||||
|
void * pvTaskHandle )
|
||||||
{
|
{
|
||||||
uint8_t * pucStackLimit;
|
uint8_t * pucStackLimit;
|
||||||
uint32_t ulSecureContextIndex;
|
uint32_t ulSecureContextIndex;
|
||||||
|
|
|
@ -108,7 +108,8 @@ void SecureContext_Init( void );
|
||||||
* @param[in] xSecureContextHandle Context handle corresponding to the
|
* @param[in] xSecureContextHandle Context handle corresponding to the
|
||||||
* context to be freed.
|
* context to be freed.
|
||||||
*/
|
*/
|
||||||
void SecureContext_FreeContext( SecureContextHandle_t xSecureContextHandle, void * pvTaskHandle );
|
void SecureContext_FreeContext( SecureContextHandle_t xSecureContextHandle,
|
||||||
|
void * pvTaskHandle );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Loads the given context.
|
* @brief Loads the given context.
|
||||||
|
@ -119,7 +120,8 @@ void SecureContext_FreeContext( SecureContextHandle_t xSecureContextHandle, void
|
||||||
* @param[in] xSecureContextHandle Context handle corresponding to the context
|
* @param[in] xSecureContextHandle Context handle corresponding to the context
|
||||||
* to be loaded.
|
* to be loaded.
|
||||||
*/
|
*/
|
||||||
void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle, void * pvTaskHandle );
|
void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle,
|
||||||
|
void * pvTaskHandle );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Saves the given context.
|
* @brief Saves the given context.
|
||||||
|
@ -130,6 +132,7 @@ void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle, void
|
||||||
* @param[in] xSecureContextHandle Context handle corresponding to the context
|
* @param[in] xSecureContextHandle Context handle corresponding to the context
|
||||||
* to be saved.
|
* to be saved.
|
||||||
*/
|
*/
|
||||||
void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle, void * pvTaskHandle );
|
void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle,
|
||||||
|
void * pvTaskHandle );
|
||||||
|
|
||||||
#endif /* __SECURE_CONTEXT_H__ */
|
#endif /* __SECURE_CONTEXT_H__ */
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* Configuration includes. */
|
||||||
|
#include "FreeRTOSConfig.h"
|
||||||
|
|
||||||
/* Secure context heap includes. */
|
/* Secure context heap includes. */
|
||||||
#include "secure_heap.h"
|
#include "secure_heap.h"
|
||||||
|
|
||||||
|
@ -62,6 +65,22 @@
|
||||||
|
|
||||||
/* Assumes 8bit bytes! */
|
/* Assumes 8bit bytes! */
|
||||||
#define secureheapBITS_PER_BYTE ( ( size_t ) 8 )
|
#define secureheapBITS_PER_BYTE ( ( size_t ) 8 )
|
||||||
|
|
||||||
|
/* Max value that fits in a size_t type. */
|
||||||
|
#define secureheapSIZE_MAX ( ~( ( size_t ) 0 ) )
|
||||||
|
|
||||||
|
/* Check if adding a and b will result in overflow. */
|
||||||
|
#define secureheapADD_WILL_OVERFLOW( a, b ) ( ( a ) > ( secureheapSIZE_MAX - ( b ) ) )
|
||||||
|
|
||||||
|
/* MSB of the xBlockSize member of an BlockLink_t structure is used to track
|
||||||
|
* the allocation status of a block. When MSB of the xBlockSize member of
|
||||||
|
* an BlockLink_t structure is set then the block belongs to the application.
|
||||||
|
* When the bit is free the block is still part of the free heap space. */
|
||||||
|
#define secureheapBLOCK_ALLOCATED_BITMASK ( ( ( size_t ) 1 ) << ( ( sizeof( size_t ) * secureheapBITS_PER_BYTE ) - 1 ) )
|
||||||
|
#define secureheapBLOCK_SIZE_IS_VALID( xBlockSize ) ( ( ( xBlockSize ) & secureheapBLOCK_ALLOCATED_BITMASK ) == 0 )
|
||||||
|
#define secureheapBLOCK_IS_ALLOCATED( pxBlock ) ( ( ( pxBlock->xBlockSize ) & secureheapBLOCK_ALLOCATED_BITMASK ) != 0 )
|
||||||
|
#define secureheapALLOCATE_BLOCK( pxBlock ) ( ( pxBlock->xBlockSize ) |= secureheapBLOCK_ALLOCATED_BITMASK )
|
||||||
|
#define secureheapFREE_BLOCK( pxBlock ) ( ( pxBlock->xBlockSize ) &= ~secureheapBLOCK_ALLOCATED_BITMASK )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Allocate the memory for the heap. */
|
/* Allocate the memory for the heap. */
|
||||||
|
@ -123,14 +142,6 @@ static BlockLink_t * pxEnd = NULL;
|
||||||
static size_t xFreeBytesRemaining = 0U;
|
static size_t xFreeBytesRemaining = 0U;
|
||||||
static size_t xMinimumEverFreeBytesRemaining = 0U;
|
static size_t xMinimumEverFreeBytesRemaining = 0U;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets set to the top bit of an size_t type.
|
|
||||||
*
|
|
||||||
* When this bit in the xBlockSize member of an BlockLink_t structure is set
|
|
||||||
* then the block belongs to the application. When the bit is free the block is
|
|
||||||
* still part of the free heap space.
|
|
||||||
*/
|
|
||||||
static size_t xBlockAllocatedBit = 0;
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvHeapInit( void )
|
static void prvHeapInit( void )
|
||||||
|
@ -175,9 +186,6 @@ static void prvHeapInit( void )
|
||||||
/* Only one block exists - and it covers the entire usable heap space. */
|
/* Only one block exists - and it covers the entire usable heap space. */
|
||||||
xMinimumEverFreeBytesRemaining = pxFirstFreeBlock->xBlockSize;
|
xMinimumEverFreeBytesRemaining = pxFirstFreeBlock->xBlockSize;
|
||||||
xFreeBytesRemaining = pxFirstFreeBlock->xBlockSize;
|
xFreeBytesRemaining = pxFirstFreeBlock->xBlockSize;
|
||||||
|
|
||||||
/* Work out the position of the top bit in a size_t variable. */
|
|
||||||
xBlockAllocatedBit = ( ( size_t ) 1 ) << ( ( sizeof( size_t ) * secureheapBITS_PER_BYTE ) - 1 );
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -229,7 +237,7 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
|
||||||
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
|
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the block being inserted plugged a gab, so was merged with the block
|
/* If the block being inserted plugged a gap, so was merged with the block
|
||||||
* before and the block after, then it's pxNextFreeBlock pointer will have
|
* before and the block after, then it's pxNextFreeBlock pointer will have
|
||||||
* already been set, and should not be set here as that would make it point
|
* already been set, and should not be set here as that would make it point
|
||||||
* to itself. */
|
* to itself. */
|
||||||
|
@ -250,6 +258,8 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
BlockLink_t * pxPreviousBlock;
|
BlockLink_t * pxPreviousBlock;
|
||||||
BlockLink_t * pxNewBlockLink;
|
BlockLink_t * pxNewBlockLink;
|
||||||
void * pvReturn = NULL;
|
void * pvReturn = NULL;
|
||||||
|
size_t xAdditionalRequiredSize;
|
||||||
|
size_t xAllocatedBlockSize = 0;
|
||||||
|
|
||||||
/* If this is the first call to malloc then the heap will require
|
/* If this is the first call to malloc then the heap will require
|
||||||
* initialisation to setup the list of free blocks. */
|
* initialisation to setup the list of free blocks. */
|
||||||
|
@ -262,36 +272,51 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
mtCOVERAGE_TEST_MARKER();
|
mtCOVERAGE_TEST_MARKER();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( xWantedSize > 0 )
|
||||||
|
{
|
||||||
|
/* The wanted size must be increased so it can contain a BlockLink_t
|
||||||
|
* structure in addition to the requested amount of bytes. */
|
||||||
|
if( secureheapADD_WILL_OVERFLOW( xWantedSize, xHeapStructSize ) == 0 )
|
||||||
|
{
|
||||||
|
xWantedSize += xHeapStructSize;
|
||||||
|
|
||||||
|
/* Ensure that blocks are always aligned to the required number
|
||||||
|
* of bytes. */
|
||||||
|
if( ( xWantedSize & secureportBYTE_ALIGNMENT_MASK ) != 0x00 )
|
||||||
|
{
|
||||||
|
/* Byte alignment required. */
|
||||||
|
xAdditionalRequiredSize = secureportBYTE_ALIGNMENT - ( xWantedSize & secureportBYTE_ALIGNMENT_MASK );
|
||||||
|
|
||||||
|
if( secureheapADD_WILL_OVERFLOW( xWantedSize, xAdditionalRequiredSize ) == 0 )
|
||||||
|
{
|
||||||
|
xWantedSize += xAdditionalRequiredSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xWantedSize = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mtCOVERAGE_TEST_MARKER();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xWantedSize = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mtCOVERAGE_TEST_MARKER();
|
||||||
|
}
|
||||||
|
|
||||||
/* Check the requested block size is not so large that the top bit is set.
|
/* Check the requested block size is not so large that the top bit is set.
|
||||||
* The top bit of the block size member of the BlockLink_t structure is used
|
* The top bit of the block size member of the BlockLink_t structure is used
|
||||||
* to determine who owns the block - the application or the kernel, so it
|
* to determine who owns the block - the application or the kernel, so it
|
||||||
* must be free. */
|
* must be free. */
|
||||||
if( ( xWantedSize & xBlockAllocatedBit ) == 0 )
|
if( secureheapBLOCK_SIZE_IS_VALID( xWantedSize ) != 0 )
|
||||||
{
|
{
|
||||||
/* The wanted size is increased so it can contain a BlockLink_t
|
|
||||||
* structure in addition to the requested amount of bytes. */
|
|
||||||
if( xWantedSize > 0 )
|
|
||||||
{
|
|
||||||
xWantedSize += xHeapStructSize;
|
|
||||||
|
|
||||||
/* Ensure that blocks are always aligned to the required number of
|
|
||||||
* bytes. */
|
|
||||||
if( ( xWantedSize & secureportBYTE_ALIGNMENT_MASK ) != 0x00 )
|
|
||||||
{
|
|
||||||
/* Byte alignment required. */
|
|
||||||
xWantedSize += ( secureportBYTE_ALIGNMENT - ( xWantedSize & secureportBYTE_ALIGNMENT_MASK ) );
|
|
||||||
secureportASSERT( ( xWantedSize & secureportBYTE_ALIGNMENT_MASK ) == 0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mtCOVERAGE_TEST_MARKER();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mtCOVERAGE_TEST_MARKER();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) )
|
if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) )
|
||||||
{
|
{
|
||||||
/* Traverse the list from the start (lowest address) block until
|
/* Traverse the list from the start (lowest address) block until
|
||||||
|
@ -334,7 +359,8 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
pxBlock->xBlockSize = xWantedSize;
|
pxBlock->xBlockSize = xWantedSize;
|
||||||
|
|
||||||
/* Insert the new block into the list of free blocks. */
|
/* Insert the new block into the list of free blocks. */
|
||||||
prvInsertBlockIntoFreeList( pxNewBlockLink );
|
pxNewBlockLink->pxNextFreeBlock = pxPreviousBlock->pxNextFreeBlock;
|
||||||
|
pxPreviousBlock->pxNextFreeBlock = pxNewBlockLink;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -352,9 +378,11 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
mtCOVERAGE_TEST_MARKER();
|
mtCOVERAGE_TEST_MARKER();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xAllocatedBlockSize = pxBlock->xBlockSize;
|
||||||
|
|
||||||
/* The block is being returned - it is allocated and owned by
|
/* The block is being returned - it is allocated and owned by
|
||||||
* the application and has no "next" block. */
|
* the application and has no "next" block. */
|
||||||
pxBlock->xBlockSize |= xBlockAllocatedBit;
|
secureheapALLOCATE_BLOCK( pxBlock );
|
||||||
pxBlock->pxNextFreeBlock = NULL;
|
pxBlock->pxNextFreeBlock = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -372,7 +400,10 @@ void * pvPortMalloc( size_t xWantedSize )
|
||||||
mtCOVERAGE_TEST_MARKER();
|
mtCOVERAGE_TEST_MARKER();
|
||||||
}
|
}
|
||||||
|
|
||||||
traceMALLOC( pvReturn, xWantedSize );
|
traceMALLOC( pvReturn, xAllocatedBlockSize );
|
||||||
|
|
||||||
|
/* Prevent compiler warnings when trace macros are not used. */
|
||||||
|
( void ) xAllocatedBlockSize;
|
||||||
|
|
||||||
#if ( secureconfigUSE_MALLOC_FAILED_HOOK == 1 )
|
#if ( secureconfigUSE_MALLOC_FAILED_HOOK == 1 )
|
||||||
{
|
{
|
||||||
|
@ -408,16 +439,16 @@ void vPortFree( void * pv )
|
||||||
pxLink = ( void * ) puc;
|
pxLink = ( void * ) puc;
|
||||||
|
|
||||||
/* Check the block is actually allocated. */
|
/* Check the block is actually allocated. */
|
||||||
secureportASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 );
|
secureportASSERT( secureheapBLOCK_IS_ALLOCATED( pxLink ) != 0 );
|
||||||
secureportASSERT( pxLink->pxNextFreeBlock == NULL );
|
secureportASSERT( pxLink->pxNextFreeBlock == NULL );
|
||||||
|
|
||||||
if( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 )
|
if( secureheapBLOCK_IS_ALLOCATED( pxLink ) != 0 )
|
||||||
{
|
{
|
||||||
if( pxLink->pxNextFreeBlock == NULL )
|
if( pxLink->pxNextFreeBlock == NULL )
|
||||||
{
|
{
|
||||||
/* The block is being returned to the heap - it is no longer
|
/* The block is being returned to the heap - it is no longer
|
||||||
* allocated. */
|
* allocated. */
|
||||||
pxLink->xBlockSize &= ~xBlockAllocatedBit;
|
secureheapFREE_BLOCK( pxLink );
|
||||||
|
|
||||||
secureportDISABLE_NON_SECURE_INTERRUPTS();
|
secureportDISABLE_NON_SECURE_INTERRUPTS();
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,7 +93,7 @@ secureportNON_SECURE_CALLABLE void SecureInit_EnableNSFPUAccess( void )
|
||||||
* permitted. CP11 should be programmed to the same value as CP10. */
|
* permitted. CP11 should be programmed to the same value as CP10. */
|
||||||
*( secureinitNSACR ) |= ( secureinitNSACR_CP10_MASK | secureinitNSACR_CP11_MASK );
|
*( secureinitNSACR ) |= ( secureinitNSACR_CP10_MASK | secureinitNSACR_CP11_MASK );
|
||||||
|
|
||||||
/* LSPENS = 0 ==> LSPEN is writable fron non-secure state. This ensures
|
/* LSPENS = 0 ==> LSPEN is writable from non-secure state. This ensures
|
||||||
* that we can enable/disable lazy stacking in port.c file. */
|
* that we can enable/disable lazy stacking in port.c file. */
|
||||||
*( secureinitFPCCR ) &= ~( secureinitFPCCR_LSPENS_MASK );
|
*( secureinitFPCCR ) &= ~( secureinitFPCCR_LSPENS_MASK );
|
||||||
|
|
||||||
|
|
46
portable/CCRH/F1Kx/README.md
Normal file
46
portable/CCRH/F1Kx/README.md
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# RH850/F1K and F1Kx FreeRTOS Port with CC-RH Compiler
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This repository contains the port of FreeRTOS for Renesas RH850/F1K and F1Kx microcontrollers using the CC-RH compiler. The following sections provide instructions on how to use this port, a link to the test project, and other relevant information.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
- Compiler: CC-RH
|
||||||
|
- FreeRTOS version 11.1.0
|
||||||
|
|
||||||
|
| Device | FPU | SMP |
|
||||||
|
|----------|-----|-----|
|
||||||
|
| F1K | Yes | No |
|
||||||
|
| F1KM-S1 | Yes | No |
|
||||||
|
| F1KM-S2 | Yes | No |
|
||||||
|
| F1KM-S4 | Yes | No |
|
||||||
|
| F1KH-D8 | Yes | Yes |
|
||||||
|
|
||||||
|
## Link to Test Project
|
||||||
|
|
||||||
|
The test project can be found [here](https://github.com/FreeRTOS/FreeRTOS-Community-Supported-Demos) (`RH850_F1Kx_CCRH`). This project contains example tasks and configurations to help you get started with FreeRTOS on the RH850/F1K and F1Kx.
|
||||||
|
|
||||||
|
## Note
|
||||||
|
1. Configure IPIR Interrupt: Ensure that the bit specifying the destination for binding (requesting) an interrupt is enabled (e.g: IBDxxx register of F1KH-D8) (1)
|
||||||
|
2. `Channel 0` and address `0xFFFEEC00` are used as default configuration for configIPIR_CHANNEL and configEXCLUSIVE_ADDRESS, in case of resource confliction other channel/address can be used. (2)
|
||||||
|
3. The minimal stack size (configMINIMAL_STACK_SIZE) must be included the reserved memory for nested interrupt. This formula can be referred: `(task_context_size) * (2 + configMAX_INT_NESTING) + Stack_depth_of_taskcode`
|
||||||
|
In which, `task_context_size` is calculated as `36*4bytes = 144bytes` (when FPU enabled) or `34*4bytes = 136` (when FPU disabled), configMAX_INT_NESTING is `02` as default (Note that a value of `0` is not allowed).
|
||||||
|
4. `configTIMER_PRESCALE`: This value is required in order to correctly configure clock for `CPUCLK_L`. Refer to Hardware Manual at `Table 44.22` for `option byte`: If the user sets the option byte `CKDIVMD to 1`, then `configTIMER_PRESCALE = 4`. Otherwise, if `CKDIVMD is set to 0`, then `configTIMER_PRESCALE = 2`.
|
||||||
|
|
||||||
|
(1) This is applicable for F1KH-D8 with SMP only.
|
||||||
|
|
||||||
|
(2) This is optional and applicable for SMP only.
|
||||||
|
|
||||||
|
## Other Relevant Information
|
||||||
|
|
||||||
|
- **Documentation:**
|
||||||
|
- Refer to the official [FreeRTOS documentation](https://www.freertos.org/Documentation/RTOS_book.html) for detailed information on configuring and using FreeRTOS.
|
||||||
|
- Consult the [RH850 F1K group user manual hardware manual](https://www.renesas.com/us/en/document/mah/rh850f1k-group-users-manual-hardware?r=1170166) for specific details about the microcontroller.
|
||||||
|
- For more information about Renesas RH850/F1K and F1Kx, please visit [this website](https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rh850-automotive-mcus)
|
||||||
|
- The CC-RH compiler can be downloaded [here](https://www.renesas.com/us/en/software-tool/c-compiler-package-rh850-family#downloads)
|
||||||
|
|
||||||
|
- **Support:**
|
||||||
|
- If you encounter any issues or have questions about this port, please open an issue in this repository or contact the maintainer.
|
||||||
|
|
||||||
|
- **Contributing:**
|
||||||
|
- Contributions to improve this port are welcome. Please fork the repository, make your changes, and submit a pull request.
|
732
portable/CCRH/F1Kx/port.c
Normal file
732
portable/CCRH/F1Kx/port.c
Normal file
|
@ -0,0 +1,732 @@
|
||||||
|
/*
|
||||||
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://www.FreeRTOS.org
|
||||||
|
* https://github.com/FreeRTOS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Scheduler includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
/* This port uses xTaskGetCurrentTaskHandle to get TCB stack, it is required to
|
||||||
|
* enable this API. */
|
||||||
|
#if ( ( INCLUDE_xTaskGetCurrentTaskHandle != 1 ) && ( configNUMBER_OF_CORES == 1 ) )
|
||||||
|
#error INCLUDE_xTaskGetCurrentTaskHandle must be set to 1 in single core.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* Macro definitions
|
||||||
|
***********************************************************/
|
||||||
|
|
||||||
|
/* Hardware specific macros */
|
||||||
|
#define portPSW_REGISTER_ID ( 5 )
|
||||||
|
#define portFPSR_REGISTER_ID ( 6 )
|
||||||
|
|
||||||
|
/* PSW.EBV and PSW.CUx bits are kept as current status */
|
||||||
|
#define portINITIAL_PSW_MASK ( 0x000f8000 )
|
||||||
|
#define portCURRENT_PSW_VALUE ( portSTSR( portPSW_REGISTER_ID ) )
|
||||||
|
#define portCURRENT_SR_ZERO_VALUE ( ( StackType_t ) 0x00000000 )
|
||||||
|
#define portCURRENT_FPSR_VALUE ( portSTSR( portFPSR_REGISTER_ID ) )
|
||||||
|
|
||||||
|
/* Mask for FPU configuration bits (FN, PEM, RM, FS) */
|
||||||
|
#define portINITIAL_FPSR_MASK ( 0x00ae0000 )
|
||||||
|
#define portPSW_ID_MASK ( 0x00000020 )
|
||||||
|
|
||||||
|
/* Define necessary hardware IO for OSTM timer. OSTM0 is used by default as
|
||||||
|
* it is common for almost device variants. If it conflicts with application,
|
||||||
|
* the application shall implement another timer.*/
|
||||||
|
#define portOSTM_EIC_ADDR ( 0xFFFFB0A8 )
|
||||||
|
#define portOSTM0CMP_ADDR ( 0xFFD70000 )
|
||||||
|
#define portOSTM0CTL_ADDR ( 0xFFD70020 )
|
||||||
|
#define portOSTM0TS_ADDR ( 0xFFD70014 )
|
||||||
|
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
|
||||||
|
/* IPIR base address, the peripheral is used for Inter-Processor communication
|
||||||
|
* Hardware supports 4 channels which is offset by 0x0, 0x4, 0x8, 0xC bytes from
|
||||||
|
* base address. By default, channel 0 is selected. */
|
||||||
|
#ifdef configIPIR_CHANNEL
|
||||||
|
#define portIPIR_BASE_ADDR ( ( 0xFFFEEC80 ) + ( configIPIR_CHANNEL << 2 ) )
|
||||||
|
#else
|
||||||
|
#define portIPIR_BASE_ADDR ( 0xFFFEEC80 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Address used for exclusive control for variable shared between PEs
|
||||||
|
* (common resources), each CPU cores have independent access path to
|
||||||
|
* this address. By default, G0MEV0 register is selected*/
|
||||||
|
#ifdef configEXCLUSIVE_ADDRESS
|
||||||
|
#define portMEV_BASE_ADDR configEXCLUSIVE_ADDRESS
|
||||||
|
#else
|
||||||
|
#define portMEV_BASE_ADDR ( 0xFFFEEC00 )
|
||||||
|
#endif
|
||||||
|
#endif /* if ( configNUMBER_OF_CORES > 1 ) */
|
||||||
|
|
||||||
|
/* Macros required to set up the initial stack. */
|
||||||
|
#define portSTACK_INITIAL_VALUE_R1 ( ( StackType_t ) 0x01010101 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R2 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x02 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R3 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x03 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R4 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x04 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R5 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x05 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R6 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x06 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R7 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x07 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R8 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x08 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R9 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x09 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R10 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x10 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R11 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x11 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R12 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x12 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R13 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x13 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R14 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x14 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R15 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x15 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R16 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x16 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R17 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x17 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R18 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x18 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R19 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x19 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R20 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x20 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R21 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x21 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R22 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x22 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R23 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x23 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R24 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x24 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R25 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x25 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R26 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x26 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R27 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x27 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R28 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x28 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R29 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x29 )
|
||||||
|
#define portSTACK_INITIAL_VALUE_R30 ( ( StackType_t ) portSTACK_INITIAL_VALUE_R1 * 0x30 )
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* Typedef definitions
|
||||||
|
***********************************************************/
|
||||||
|
|
||||||
|
/* OSTM Count Start Trigger Register (OSTMnTS) */
|
||||||
|
#define portOSTM_COUNTER_START ( 0x01U ) /* Starts the counter */
|
||||||
|
|
||||||
|
/* OSTM Count Stop Trigger Register (OSTMnTT) */
|
||||||
|
#define portOSTM_COUNTER_STOP ( 0x01U ) /* Stops the counter */
|
||||||
|
|
||||||
|
/* OSTM Control Register (OSTMnCTL) */
|
||||||
|
#define portOSTM_MODE_INTERVAL_TIMER ( 0x00U )
|
||||||
|
#define portOSTM_MODE_FREE_RUNNING ( 0x02U )
|
||||||
|
|
||||||
|
/* Disables or Enable the interrupts when counting starts */
|
||||||
|
#define portOSTM_START_INTERRUPT_DISABLE ( 0x00U )
|
||||||
|
#define portOSTM_START_INTERRUPT_ENABLE ( 0x01U )
|
||||||
|
|
||||||
|
/* Interrupt vector method select (TBxxx) */
|
||||||
|
#define portINT_DIRECT_VECTOR ( 0x0U )
|
||||||
|
#define portINT_TABLE_VECTOR ( 0x1U )
|
||||||
|
|
||||||
|
/* Interrupt mask (MKxxx) */
|
||||||
|
#define portINT_PROCESSING_ENABLED ( 0x0U )
|
||||||
|
#define portINT_PROCESSING_DISABLED ( 0x1U )
|
||||||
|
|
||||||
|
/* Specify 16 interrupt priority levels */
|
||||||
|
#define portINT_PRIORITY_HIGHEST ( 0x0000U ) /* Level 0 (highest) */
|
||||||
|
#define portINT_PRIORITY_LEVEL1 ( 0x0001U ) /* Level 1 */
|
||||||
|
#define portINT_PRIORITY_LEVEL2 ( 0x0002U ) /* Level 2 */
|
||||||
|
#define portINT_PRIORITY_LEVEL3 ( 0x0003U ) /* Level 3 */
|
||||||
|
#define portINT_PRIORITY_LEVEL4 ( 0x0004U ) /* Level 4 */
|
||||||
|
#define portINT_PRIORITY_LEVEL5 ( 0x0005U ) /* Level 5 */
|
||||||
|
#define portINT_PRIORITY_LEVEL6 ( 0x0006U ) /* Level 6 */
|
||||||
|
#define portINT_PRIORITY_LEVEL7 ( 0x0007U ) /* Level 7 */
|
||||||
|
#define portINT_PRIORITY_LEVEL8 ( 0x0008U ) /* Level 8 */
|
||||||
|
#define portINT_PRIORITY_LEVEL9 ( 0x0009U ) /* Level 9 */
|
||||||
|
#define portINT_PRIORITY_LEVEL10 ( 0x000AU ) /* Level 10 */
|
||||||
|
#define portINT_PRIORITY_LEVEL11 ( 0x000BU ) /* Level 11 */
|
||||||
|
#define portINT_PRIORITY_LEVEL12 ( 0x000CU ) /* Level 12 */
|
||||||
|
#define portINT_PRIORITY_LEVEL13 ( 0x000DU ) /* Level 13 */
|
||||||
|
#define portINT_PRIORITY_LEVEL14 ( 0x000EU ) /* Level 14 */
|
||||||
|
#define portINT_PRIORITY_LOWEST ( 0x000FU ) /* Level 15 (lowest) */
|
||||||
|
|
||||||
|
/* Macros indicating status of scheduler request */
|
||||||
|
#define PORT_SCHEDULER_NOREQUEST 0UL
|
||||||
|
#define PORT_SCHEDULER_TASKSWITCH 1UL /* Do not modify */
|
||||||
|
#define PORT_SCHEDULER_STARTFIRSTTASK 2UL /* Do not modify */
|
||||||
|
|
||||||
|
#ifndef configSETUP_TICK_INTERRUPT
|
||||||
|
|
||||||
|
/* The user has not provided their own tick interrupt configuration so use
|
||||||
|
* the definition in this file (which uses the interval timer). */
|
||||||
|
#define configSETUP_TICK_INTERRUPT() prvSetupTimerInterrupt()
|
||||||
|
#endif /* configSETUP_TICK_INTERRUPT */
|
||||||
|
|
||||||
|
#if ( !defined( configMAX_INT_NESTING ) || ( configMAX_INT_NESTING == 0 ) )
|
||||||
|
|
||||||
|
/* Set the default value for depth of nested interrupt. In theory, the
|
||||||
|
* microcontroller have mechanism to limit number of nested level of interrupt
|
||||||
|
* by priority (maximum 16 levels). However, the large stack memory should be
|
||||||
|
* prepared for each task to save resource in interrupt handler. Therefore, it
|
||||||
|
* is necessary to limit depth of nesting interrupt to optimize memory usage.
|
||||||
|
* In addition, the execution time of interrupt handler should be very short
|
||||||
|
* (typically not exceed 20us), this constraint does not impact to system.
|
||||||
|
*/
|
||||||
|
#define configMAX_INT_NESTING 2UL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used to catch tasks that attempt to return from their implementing function.
|
||||||
|
*/
|
||||||
|
static void prvTaskExitError( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets up the periodic ISR used for the RTOS tick using the OSTM.
|
||||||
|
* The application writer can define configSETUP_TICK_INTERRUPT() (in
|
||||||
|
* FreeRTOSConfig.h) such that their own tick interrupt configuration is used
|
||||||
|
* in place of prvSetupTimerInterrupt().
|
||||||
|
*/
|
||||||
|
static void prvSetupTimerInterrupt( void );
|
||||||
|
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions implement spin-lock between cores by atomic accesses to Exclusive
|
||||||
|
* Control Register (G0MEVm). There are separated access path between CPU cores,
|
||||||
|
* but they should wait if access to same register
|
||||||
|
*/
|
||||||
|
static void prvExclusiveLock( BaseType_t xFromIsr );
|
||||||
|
static void prvExclusiveRelease( BaseType_t xFromIsr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function to start the first task executing
|
||||||
|
*/
|
||||||
|
extern void vPortStartFirstTask( void );
|
||||||
|
|
||||||
|
/* Scheduler request on each cores which are starting first task and switching
|
||||||
|
* context */
|
||||||
|
volatile BaseType_t xPortScheduleStatus[ configNUMBER_OF_CORES ] = { 0 };
|
||||||
|
|
||||||
|
/* Counts the interrupt nesting depth. A context switch is only performed if
|
||||||
|
* the nesting depth is 0. In addition, the interrupt shares same stack
|
||||||
|
* allocated for each tasks. With supporting nesting interrupt, the stack
|
||||||
|
* may be overflowed.
|
||||||
|
* It is necessary to control maximum stack depth.
|
||||||
|
*/
|
||||||
|
volatile UBaseType_t uxInterruptNesting[ configNUMBER_OF_CORES ] = { 0 };
|
||||||
|
volatile const UBaseType_t uxPortMaxInterruptDepth = configMAX_INT_NESTING;
|
||||||
|
|
||||||
|
/* Count number of nested locks by same cores. The lock is completely released
|
||||||
|
* only if this count is decreased to 0, the lock is separated for task
|
||||||
|
* and isr */
|
||||||
|
UBaseType_t uxLockNesting[ configNUMBER_OF_CORES ][ 2 ] = { 0 };
|
||||||
|
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
|
||||||
|
/* Pointer to exclusive access memory */
|
||||||
|
volatile BaseType_t * pxPortExclusiveReg = ( volatile BaseType_t * ) ( portMEV_BASE_ADDR );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Interrupt handler for OSTM timer which handling tick increment and resulting
|
||||||
|
* to switch context. */
|
||||||
|
void vPortTickISR( void );
|
||||||
|
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
|
||||||
|
/* Yield specific cores by send inter-processor interrupt */
|
||||||
|
void vPortYieldCore( uint32_t xCoreID );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Inter-processor interrupt handler. The interrupt is triggered by
|
||||||
|
* portYIELD_CORE().
|
||||||
|
*/
|
||||||
|
void vPortIPIHander( void );
|
||||||
|
|
||||||
|
/* These functions below implement recursive spinlock for exclusive access among
|
||||||
|
* cores. The core will wait until lock will be available, whilst the core which
|
||||||
|
* already had lock can acquire lock without waiting. This function could be
|
||||||
|
* call from task and interrupt context, the critical section is called
|
||||||
|
* as in ISR */
|
||||||
|
void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr );
|
||||||
|
void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr );
|
||||||
|
|
||||||
|
#endif /* (configNUMBER_OF_CORES > 1) */
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These below functions implement interrupt mask from interrupt. They are not
|
||||||
|
* called in nesting, it is protected by FreeRTOS kernel.
|
||||||
|
*/
|
||||||
|
portLONG xPortSetInterruptMask( void )
|
||||||
|
{
|
||||||
|
portLONG ulPSWValue = portSTSR( portPSW_REGISTER_ID );
|
||||||
|
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
|
|
||||||
|
/* It returns current value of Program Status Word register */
|
||||||
|
return ulPSWValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vPortClearInterruptMask( portLONG uxSavedInterruptStatus )
|
||||||
|
{
|
||||||
|
portLONG ulPSWValue = portSTSR( portPSW_REGISTER_ID );
|
||||||
|
|
||||||
|
/* Interrupt Disable status is indicates by bit#5 of PSW
|
||||||
|
* (1: Interrupt is disabled; 0: Interrupt is enabled) */
|
||||||
|
|
||||||
|
/* Revert to the status before interrupt mask. */
|
||||||
|
ulPSWValue &= ( ~( portPSW_ID_MASK ) );
|
||||||
|
ulPSWValue |= ( portPSW_ID_MASK & uxSavedInterruptStatus );
|
||||||
|
portLDSR( portPSW_REGISTER_ID, ulPSWValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using CC-RH intrinsic function to get HTCFG0 (regID, selID) = (0,2)
|
||||||
|
* Core ID is indicates by bit HTCFG0.PEID located at bit 18 to 16
|
||||||
|
* Bit 31 to 19 are read only and always be read as 0. HTCFG0.PEID is 1 and 2
|
||||||
|
* corresponding to core 0 (PE1) and core 1 (PE2). It is adjusted to 0 and 1.
|
||||||
|
*/
|
||||||
|
BaseType_t xPortGET_CORE_ID( void )
|
||||||
|
{
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
return ( portSTSR_CCRH( 0, 2 ) >> 16 ) - 1;
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* In single core, xPortGET_CORE_ID is used in this port only.
|
||||||
|
* The dummy core ID could be controlled inside this port. */
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This port supports both multi-cores and single-core, whilst TCB stack
|
||||||
|
* variables are different which are respectively pxCurrentTCB (single-core)
|
||||||
|
* and pxCurrentTCBs[] (multiple-cores). This function is defined to obtains
|
||||||
|
* TCBs of current cores. Also, the C function could switch to corresponding
|
||||||
|
* pointer by pre-compile conditions.
|
||||||
|
*/
|
||||||
|
void * pvPortGetCurrentTCB( void )
|
||||||
|
{
|
||||||
|
void * pvCurrentTCB = ( void * ) xTaskGetCurrentTaskHandle();
|
||||||
|
|
||||||
|
configASSERT( pvCurrentTCB != NULL );
|
||||||
|
|
||||||
|
return pvCurrentTCB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function checks if a context switch is required and, if so, updates
|
||||||
|
* the scheduler status for the core on which the function is called. The
|
||||||
|
* scheduler status is set to indicate that a task switch should occur.
|
||||||
|
*/
|
||||||
|
void vPortSetSwitch( BaseType_t xSwitchRequired )
|
||||||
|
{
|
||||||
|
if( xSwitchRequired != pdFALSE )
|
||||||
|
{
|
||||||
|
xPortScheduleStatus[ xPortGET_CORE_ID() ] = PORT_SCHEDULER_TASKSWITCH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup the stack of a new task so it is ready to be placed under the
|
||||||
|
* scheduler control. The registers have to be placed on the stack in the
|
||||||
|
* order that the port expects to find them.
|
||||||
|
*
|
||||||
|
* @param[in] pxTopOfStack Pointer to top of this task's stack
|
||||||
|
* @param[in] pxCode Task function, stored as initial PC for the task
|
||||||
|
* @param[in] pvParameters Parameters for task
|
||||||
|
*/
|
||||||
|
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
||||||
|
TaskFunction_t pxCode,
|
||||||
|
void * pvParameters )
|
||||||
|
{
|
||||||
|
/* Simulate the stack frame as it would be created by
|
||||||
|
* a context switch interrupt. */
|
||||||
|
*pxTopOfStack = ( StackType_t ) prvTaskExitError; /* R31 (LP) */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R5; /* R5 (TP) */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) pvParameters; /* R6 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R7; /* R7 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R8; /* R8 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R9; /* R9 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R10; /* R10 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R11; /* R11 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R12; /* R12 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R13; /* R13 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R14; /* R14 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R15; /* R15 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R16; /* R16 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R17; /* R17 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R18; /* R18 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R19; /* R19 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R20; /* R20 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R21; /* R21 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R22; /* R22 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R23; /* R23 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R24; /* R24 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R25; /* R25 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R26; /* R26 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R27; /* R27 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R28; /* R28 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R29; /* R29 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R30; /* R30 (EP) */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R1; /* R1 */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portSTACK_INITIAL_VALUE_R2; /* R2 */
|
||||||
|
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* Keep System pre-configuration (HV, CUx, EBV) as current setting in
|
||||||
|
* PSW register */
|
||||||
|
*pxTopOfStack = ( StackType_t ) ( portCURRENT_PSW_VALUE & portINITIAL_PSW_MASK ); /* EIPSW */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) pxCode; /* EIPC */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portCURRENT_SR_ZERO_VALUE; /* EIIC */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) ( portCURRENT_PSW_VALUE & portINITIAL_PSW_MASK ); /* CTPSW */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portCURRENT_SR_ZERO_VALUE; /* CTPC */
|
||||||
|
|
||||||
|
/* __FPU is defined by CCRH compiler if FPU is enabled */
|
||||||
|
#if ( configENABLE_FPU == 1 )
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) ( portCURRENT_FPSR_VALUE & portINITIAL_FPSR_MASK ); /* FPSR */
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( StackType_t ) portCURRENT_SR_ZERO_VALUE; /* FPEPC */
|
||||||
|
#endif /* (configENABLE_FPU == 1) */
|
||||||
|
|
||||||
|
return pxTopOfStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Configures the tick frequency and starts the first task.
|
||||||
|
*/
|
||||||
|
BaseType_t xPortStartScheduler( void )
|
||||||
|
{
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
BaseType_t xCurrentCore = xPortGET_CORE_ID();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Prevent interrupt by timer interrupt during starting first task.
|
||||||
|
* The interrupt shall be enabled automatically by being restored from
|
||||||
|
* task stack */
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
|
|
||||||
|
/* Setup the tick interrupt */
|
||||||
|
configSETUP_TICK_INTERRUPT();
|
||||||
|
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
/* Start scheduler on other cores */
|
||||||
|
for( uint16_t xCoreID = 0; xCoreID < configNUMBER_OF_CORES; xCoreID++ )
|
||||||
|
{
|
||||||
|
if( xCoreID != xCurrentCore )
|
||||||
|
{
|
||||||
|
/* Send yielding request to other cores with flag to start
|
||||||
|
* first task. TaskContextSwitch is not executed */
|
||||||
|
xPortScheduleStatus[ xCoreID ] = PORT_SCHEDULER_STARTFIRSTTASK;
|
||||||
|
vPortYieldCore( xCoreID );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Nothing to do. The first task is started in this call by
|
||||||
|
* below vPortStartFirstTask() */
|
||||||
|
xPortScheduleStatus[ xCoreID ] = PORT_SCHEDULER_NOREQUEST;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* if ( configNUMBER_OF_CORES > 1 ) */
|
||||||
|
|
||||||
|
/* Start first task in primary core */
|
||||||
|
vPortStartFirstTask();
|
||||||
|
|
||||||
|
/* Should never get here as the tasks will now be executing! */
|
||||||
|
prvTaskExitError();
|
||||||
|
|
||||||
|
/* To prevent compiler warnings in the case that the application writer
|
||||||
|
* overrides this functionality by defining configTASK_RETURN_ADDRESS.
|
||||||
|
* Call vTaskSwitchContext() so link time optimization does not remove
|
||||||
|
* the symbol. */
|
||||||
|
vTaskSwitchContext(
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
xCurrentCore
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
|
return pdFALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used to catch tasks that attempt to return from their implementing function.
|
||||||
|
*/
|
||||||
|
static void prvTaskExitError( void )
|
||||||
|
{
|
||||||
|
/* A function that implements a task must not exit or attempt to return to
|
||||||
|
* its caller as there is nothing to return to. If a task wants to exit it
|
||||||
|
* should instead call vTaskDelete( NULL ).
|
||||||
|
*
|
||||||
|
* Artificially force an assert() to be triggered if configASSERT() is
|
||||||
|
* defined, then stop here so application writers can catch the error. */
|
||||||
|
|
||||||
|
/* This statement will always fail, triggering the assert */
|
||||||
|
configASSERT( pdFALSE );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following statement may be unreachable because configASSERT(pdFALSE)
|
||||||
|
* always triggers an assertion failure, which typically halts program
|
||||||
|
* execution.
|
||||||
|
* The warning may be reported to indicate to indicate that the compiler
|
||||||
|
* detects the subsequent code will not be executed.
|
||||||
|
* The warning is acceptable to ensure program is halt regardless of
|
||||||
|
* configASSERT(pdFALSE) implementation
|
||||||
|
*/
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
|
|
||||||
|
for( ; ; )
|
||||||
|
{
|
||||||
|
/* Infinite loop to ensure the function does not return. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vPortEndScheduler( void )
|
||||||
|
{
|
||||||
|
/* Not implemented in ports where there is nothing to return to.
|
||||||
|
* Artificially force an assert. */
|
||||||
|
configASSERT( pdFALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
|
||||||
|
void vPortYieldCore( uint32_t xCoreID )
|
||||||
|
{
|
||||||
|
/* Check if we need to yield on a different core */
|
||||||
|
if( xCoreID != xPortGET_CORE_ID() )
|
||||||
|
{
|
||||||
|
volatile uint32_t * pulIPIRReg;
|
||||||
|
|
||||||
|
/* Determine the IPI register based on the target core ID */
|
||||||
|
pulIPIRReg = ( volatile uint32_t * ) ( portIPIR_BASE_ADDR );
|
||||||
|
|
||||||
|
/*Inter-processor interrupt generates an interrupt request by
|
||||||
|
* writing 1 to applicable bits of target cores. The interrupt
|
||||||
|
* should be enabled by application in corresponding cores
|
||||||
|
* including PSW.ID (EI instruction) and interrupt control setting
|
||||||
|
* for ICIPIRn channel (interrupt mask, vector method)
|
||||||
|
*/
|
||||||
|
*pulIPIRReg = ( 1 << xCoreID );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Yielding current core */
|
||||||
|
vPortYield();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handler for inter-processor interrupt in second cores. The interrupt is
|
||||||
|
* triggered by portYIELD_CORE(). vTaskSwitchContext() is invoked to
|
||||||
|
* switch tasks
|
||||||
|
*/
|
||||||
|
void vPortIPIHander( void )
|
||||||
|
{
|
||||||
|
BaseType_t xCurrentCore = xPortGET_CORE_ID();
|
||||||
|
|
||||||
|
/* 1st execution starts 1st task, TaskSwitchContext is not executed */
|
||||||
|
if( PORT_SCHEDULER_STARTFIRSTTASK != xPortScheduleStatus[ xCurrentCore ] )
|
||||||
|
{
|
||||||
|
xPortScheduleStatus[ xCurrentCore ] = PORT_SCHEDULER_TASKSWITCH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif /* (configNUMBER_OF_CORES > 1) */
|
||||||
|
|
||||||
|
void vPortTickISR( void )
|
||||||
|
{
|
||||||
|
/* In case of multicores with SMP, xTaskIncrementTick is required to
|
||||||
|
* called in critical section to avoid conflict resource as this function
|
||||||
|
* could be called by xTaskResumeAll() from any cores. */
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
BaseType_t xSavedInterruptStatus;
|
||||||
|
|
||||||
|
xSavedInterruptStatus = portENTER_CRITICAL_FROM_ISR();
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/* Increment the RTOS tick. */
|
||||||
|
if( xTaskIncrementTick() != pdFALSE )
|
||||||
|
{
|
||||||
|
/* Pend a context switch. */
|
||||||
|
xPortScheduleStatus[ xPortGET_CORE_ID() ] = PORT_SCHEDULER_TASKSWITCH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
portEXIT_CRITICAL_FROM_ISR( xSavedInterruptStatus );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvSetupTimerInterrupt( void )
|
||||||
|
{
|
||||||
|
volatile uint32_t * pulOSTMIntReg;
|
||||||
|
|
||||||
|
/* Interrupt configuration for OSTM Timer
|
||||||
|
* By default, the second lowest priority is set for timer interrupt to
|
||||||
|
* avoid blocking other interrupt. Normally, user could set the lowest
|
||||||
|
* priority for non-critical event. It try to keep timer on time.
|
||||||
|
* In addition, direct vector table is used by default.
|
||||||
|
*/
|
||||||
|
pulOSTMIntReg = ( volatile uint32_t * ) portOSTM_EIC_ADDR;
|
||||||
|
*pulOSTMIntReg = ( portINT_PROCESSING_ENABLED | portINT_DIRECT_VECTOR | portINT_PRIORITY_LEVEL14 );
|
||||||
|
|
||||||
|
/* Set OSTM0 control setting */
|
||||||
|
*( ( volatile uint32_t * ) portOSTM0CTL_ADDR ) =
|
||||||
|
( portOSTM_MODE_INTERVAL_TIMER | portOSTM_START_INTERRUPT_DISABLE );
|
||||||
|
*( ( volatile uint32_t * ) portOSTM0CMP_ADDR ) =
|
||||||
|
( ( configCPU_CLOCK_HZ / configTIMER_PRESCALE ) / configTICK_RATE_HZ ) - 1;
|
||||||
|
|
||||||
|
/* Enable OSTM0 operation */
|
||||||
|
*( ( volatile uint32_t * ) portOSTM0TS_ADDR ) = portOSTM_COUNTER_START;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These functions implement spin-lock mechanism among cores using hardware
|
||||||
|
* exclusive control with atomic access by CLR1 and SET1 instruction.
|
||||||
|
* Nesting calls to these APIs are possible.
|
||||||
|
*/
|
||||||
|
#pragma inline_asm prvExclusiveLock
|
||||||
|
static void prvExclusiveLock( BaseType_t xBitPosition )
|
||||||
|
{
|
||||||
|
/* No problem with r19, CCRH does not required to restore same value
|
||||||
|
* before and after function call. */
|
||||||
|
mov # _pxPortExclusiveReg, r19
|
||||||
|
ld.w 0[ r19 ], r19
|
||||||
|
|
||||||
|
prvExclusiveLock_Lock:
|
||||||
|
|
||||||
|
/* r6 is xBitPosition */
|
||||||
|
set1 r6, [ r19 ]
|
||||||
|
bz prvExclusiveLock_Lock_success
|
||||||
|
snooze
|
||||||
|
br prvExclusiveLock_Lock
|
||||||
|
|
||||||
|
prvExclusiveLock_Lock_success:
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#pragma inline_asm prvExclusiveRelease
|
||||||
|
static void prvExclusiveRelease( BaseType_t xBitPosition )
|
||||||
|
{
|
||||||
|
mov # _pxPortExclusiveReg, r19
|
||||||
|
ld.w 0[ r19 ], r19
|
||||||
|
|
||||||
|
/* r6 is xBitPosition */
|
||||||
|
clr1 r6, [ r19 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr )
|
||||||
|
{
|
||||||
|
BaseType_t xSavedInterruptStatus;
|
||||||
|
BaseType_t xBitPosition = ( xFromIsr == pdTRUE );
|
||||||
|
|
||||||
|
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
|
|
||||||
|
if( uxLockNesting[ xCoreID ][ xBitPosition ] == 0 )
|
||||||
|
{
|
||||||
|
prvExclusiveLock( xBitPosition );
|
||||||
|
}
|
||||||
|
|
||||||
|
uxLockNesting[ xCoreID ][ xBitPosition ]++;
|
||||||
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||||
|
}
|
||||||
|
|
||||||
|
void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr )
|
||||||
|
{
|
||||||
|
BaseType_t xSavedInterruptStatus;
|
||||||
|
BaseType_t xBitPosition = ( xFromIsr == pdTRUE );
|
||||||
|
|
||||||
|
xSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
|
|
||||||
|
/* Sync memory */
|
||||||
|
portSYNCM();
|
||||||
|
|
||||||
|
/* Error check whether vPortRecursiveLockRelease() is not called in
|
||||||
|
* pair with vPortRecursiveLockAcquire() */
|
||||||
|
configASSERT( ( uxLockNesting[ xCoreID ][ xBitPosition ] > 0 ) );
|
||||||
|
uxLockNesting[ xCoreID ][ xBitPosition ]--;
|
||||||
|
|
||||||
|
if( uxLockNesting[ xCoreID ][ xBitPosition ] == 0 )
|
||||||
|
{
|
||||||
|
prvExclusiveRelease( xBitPosition );
|
||||||
|
}
|
||||||
|
|
||||||
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( xSavedInterruptStatus );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif /* (configNUMBER_OF_CORES > 1) */
|
331
portable/CCRH/F1Kx/portasm.s
Normal file
331
portable/CCRH/F1Kx/portasm.s
Normal file
|
@ -0,0 +1,331 @@
|
||||||
|
;/*
|
||||||
|
; * FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
|
; * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
; *
|
||||||
|
; * SPDX-License-Identifier: MIT
|
||||||
|
; *
|
||||||
|
; * Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
; * this software and associated documentation files (the "Software"), to deal in
|
||||||
|
; * the Software without restriction, including without limitation the rights to
|
||||||
|
; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
; * the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
; * subject to the following conditions:
|
||||||
|
; *
|
||||||
|
; * The above copyright notice and this permission notice shall be included in all
|
||||||
|
; * copies or substantial portions of the Software.
|
||||||
|
; *
|
||||||
|
; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
; *
|
||||||
|
; * https://www.FreeRTOS.org
|
||||||
|
; * https://github.com/FreeRTOS
|
||||||
|
; *
|
||||||
|
; */
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; Extern symbols
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
.extern _uxInterruptNesting
|
||||||
|
.extern _uxPortMaxInterruptDepth
|
||||||
|
.extern _xPortScheduleStatus
|
||||||
|
.extern _vTaskSwitchContext
|
||||||
|
.extern _pvPortGetCurrentTCB
|
||||||
|
.extern _vCommonISRHandler
|
||||||
|
.extern _xPortGET_CORE_ID
|
||||||
|
|
||||||
|
.public _vIrq_Handler
|
||||||
|
.public _vPortStartFirstTask
|
||||||
|
.public _vPortYield
|
||||||
|
.public _vTRAP0_Handler
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; Macro definitions
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
EIPC .set 0
|
||||||
|
EIPSW .set 1
|
||||||
|
PSW .set 5
|
||||||
|
FPSR .set 6
|
||||||
|
FPEPC .set 7
|
||||||
|
EIIC .set 13
|
||||||
|
CTPC .set 16
|
||||||
|
CTPSW .set 17
|
||||||
|
EIIC_MSK .set 0x00000FFF
|
||||||
|
FPU_MSK .set 0x00010000
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; portSAVE_CONTEXT
|
||||||
|
; Context saving
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
portSAVE_CONTEXT .macro
|
||||||
|
prepare lp, 0
|
||||||
|
|
||||||
|
; Save general-purpose registers and EIPSW, EIPC, EIIC, CTPSW, CTPC into stack.
|
||||||
|
pushsp r5, r30
|
||||||
|
$nowarning
|
||||||
|
pushsp r1, r2
|
||||||
|
$warning
|
||||||
|
|
||||||
|
stsr EIPSW, r15
|
||||||
|
stsr EIPC, r16
|
||||||
|
stsr EIIC, r17
|
||||||
|
stsr CTPSW, r18
|
||||||
|
stsr CTPC, r19
|
||||||
|
pushsp r15, r19
|
||||||
|
|
||||||
|
; Save FPU registers to stack if FPU is enabled
|
||||||
|
mov FPU_MSK, r19
|
||||||
|
tst r15, r19
|
||||||
|
|
||||||
|
; Jump over next 3 instructions: stsr (4 bytes)*2 + pushsp (4 bytes)
|
||||||
|
bz 12
|
||||||
|
stsr FPSR, r18
|
||||||
|
stsr FPEPC, r19
|
||||||
|
pushsp r18, r19
|
||||||
|
|
||||||
|
; Save EIPSW register to stack
|
||||||
|
; Due to the syntax of the pushsp instruction, using r14 as dummy value
|
||||||
|
pushsp r14, r15
|
||||||
|
|
||||||
|
; Get current TCB, the return value is stored in r10 (CCRH compiler)
|
||||||
|
jarl _pvPortGetCurrentTCB, lp
|
||||||
|
st.w sp, 0[r10]
|
||||||
|
|
||||||
|
.endm
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; portRESTORE_CONTEXT
|
||||||
|
; Context restoring
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
portRESTORE_CONTEXT .macro
|
||||||
|
; Current TCB is returned by r10 (CCRH compiler)
|
||||||
|
jarl _pvPortGetCurrentTCB, lp
|
||||||
|
ld.w 0[r10], sp ; Restore the stack pointer from the TCB
|
||||||
|
|
||||||
|
; Restore FPU registers if FPU is enabled
|
||||||
|
mov FPU_MSK, r19
|
||||||
|
; Restore EIPSW register to check FPU
|
||||||
|
; Due to the syntax of the popsp instruction, using r14 as dummy value
|
||||||
|
popsp r14, r15
|
||||||
|
tst r15, r19
|
||||||
|
; Jump over next 3 instructions: stsr (4 bytes)*2 + popsp (4 bytes)
|
||||||
|
bz 12
|
||||||
|
popsp r18, r19
|
||||||
|
ldsr r19, FPEPC
|
||||||
|
ldsr r18, FPSR
|
||||||
|
|
||||||
|
;Restore general-purpose registers and EIPSW, EIPC, EIIC, CTPSW, CTPC
|
||||||
|
popsp r15, r19
|
||||||
|
ldsr r19, CTPC
|
||||||
|
ldsr r18, CTPSW
|
||||||
|
ldsr r17, EIIC
|
||||||
|
ldsr r16, EIPC
|
||||||
|
ldsr r15, EIPSW
|
||||||
|
|
||||||
|
$nowarning
|
||||||
|
popsp r1, r2
|
||||||
|
$warning
|
||||||
|
popsp r5, r30
|
||||||
|
|
||||||
|
dispose 0, lp
|
||||||
|
.endm
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; Save used registers
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
SAVE_REGISTER .macro
|
||||||
|
; Save general-purpose registers and EIPSW, EIPC, EIIC, CTPSW, CTPC into stack.
|
||||||
|
; Callee-Save registers (r20 to r30) are not used in interrupt handler and
|
||||||
|
; guaranteed no change after function call. So, don't need to save register
|
||||||
|
; to optimize the used stack memory.
|
||||||
|
pushsp r5, r19
|
||||||
|
$nowarning
|
||||||
|
pushsp r1, r2
|
||||||
|
$warning
|
||||||
|
|
||||||
|
stsr EIPSW, r19
|
||||||
|
stsr EIPC, r18
|
||||||
|
stsr EIIC, r17
|
||||||
|
mov lp, r16
|
||||||
|
mov ep, r15
|
||||||
|
stsr CTPSW, r14
|
||||||
|
stsr CTPC, r13
|
||||||
|
pushsp r13, r18
|
||||||
|
|
||||||
|
mov FPU_MSK, r16
|
||||||
|
tst r16, r19
|
||||||
|
bz 8
|
||||||
|
stsr FPSR, r17
|
||||||
|
stsr FPEPC, r18
|
||||||
|
|
||||||
|
pushsp r17, r19
|
||||||
|
|
||||||
|
.endm
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; Restore used registers
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
RESTORE_REGISTER .macro
|
||||||
|
|
||||||
|
mov FPU_MSK, r15
|
||||||
|
popsp r17, r19
|
||||||
|
tst r19, r15
|
||||||
|
bz 8
|
||||||
|
ldsr r18, FPEPC
|
||||||
|
ldsr r17, FPSR
|
||||||
|
|
||||||
|
popsp r13, r18
|
||||||
|
ldsr r13, CTPC
|
||||||
|
ldsr r14, CTPSW
|
||||||
|
mov r15, ep
|
||||||
|
mov r16, lp
|
||||||
|
ldsr r17, EIIC
|
||||||
|
ldsr r18, EIPC
|
||||||
|
ldsr r19, EIPSW
|
||||||
|
|
||||||
|
$nowarning
|
||||||
|
popsp r1, r2
|
||||||
|
$warning
|
||||||
|
popsp r5, r19
|
||||||
|
.endm
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; Start the first task.
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
_vPortStartFirstTask:
|
||||||
|
portRESTORE_CONTEXT
|
||||||
|
eiret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; _vPortYield
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
_vPortYield:
|
||||||
|
trap 0
|
||||||
|
jmp [lp] ; Return to caller function
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; PortYield handler. This is installed as the TRAP exception handler.
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
_vTRAP0_Handler:
|
||||||
|
;Save the context of the current task.
|
||||||
|
portSAVE_CONTEXT
|
||||||
|
|
||||||
|
; The use case that portYield() is called from interrupt context as nested interrupt.
|
||||||
|
; Context switch should be executed at the most outer of interrupt tree.
|
||||||
|
; In that case, set xPortScheduleStatus to flag context switch in interrupt handler.
|
||||||
|
jarl _xPortGET_CORE_ID, lp ; return value is contained in r10 (CCRH compiler)
|
||||||
|
mov r10, r11
|
||||||
|
shl 2, r11
|
||||||
|
mov #_uxInterruptNesting, r19
|
||||||
|
add r11, r19
|
||||||
|
ld.w 0[r19], r18
|
||||||
|
cmp r0, r18
|
||||||
|
be _vTRAP0_Handler_ContextSwitch
|
||||||
|
|
||||||
|
mov #_xPortScheduleStatus, r19
|
||||||
|
add r11, r19
|
||||||
|
|
||||||
|
; Set xPortScheduleStatus[coreID]=PORT_SCHEDULER_TASKSWITCH
|
||||||
|
mov 1, r17
|
||||||
|
st.w r17, 0[r19]
|
||||||
|
br _vTRAP0_Handler_Exit
|
||||||
|
|
||||||
|
_vTRAP0_Handler_ContextSwitch:
|
||||||
|
; Pass coreID (r10) as parameter by r6 (CCRH compiler) in SMP support.
|
||||||
|
mov r10, r6
|
||||||
|
; Call the scheduler to select the next task.
|
||||||
|
; vPortYeild may be called to current core again at the end of vTaskSwitchContext.
|
||||||
|
; This may case nested interrupt, however, it is not necessary to set
|
||||||
|
; uxInterruptNesting (currently 0) for nested trap0 exception. The user interrupt
|
||||||
|
; (EI level interrupt) is not accepted inside of trap0 exception.
|
||||||
|
jarl _vTaskSwitchContext, lp
|
||||||
|
|
||||||
|
_vTRAP0_Handler_Exit:
|
||||||
|
; Restore the context of the next task to run.
|
||||||
|
portRESTORE_CONTEXT
|
||||||
|
eiret
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; _Irq_Handler
|
||||||
|
; Handler interrupt service routine (ISR).
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
_vIrq_Handler:
|
||||||
|
; Save used registers.
|
||||||
|
SAVE_REGISTER
|
||||||
|
|
||||||
|
; Get core ID by HTCFG0, thread configuration register.
|
||||||
|
; Then, increase nesting count for current core.
|
||||||
|
jarl _xPortGET_CORE_ID, lp ; return value is contained in r10 (CCRH compiler)
|
||||||
|
shl 2, r10
|
||||||
|
mov r10, r17
|
||||||
|
|
||||||
|
mov #_uxInterruptNesting, r19
|
||||||
|
add r17, r19
|
||||||
|
ld.w 0[r19], r18
|
||||||
|
addi 0x1, r18, r16
|
||||||
|
st.w r16, 0[r19]
|
||||||
|
|
||||||
|
pushsp r17, r19
|
||||||
|
|
||||||
|
;Call the interrupt handler.
|
||||||
|
stsr EIIC, r6
|
||||||
|
andi EIIC_MSK, r6, r6
|
||||||
|
|
||||||
|
; Do not enable interrupt for nesting. Stackover flow may occurs if the
|
||||||
|
; depth of nesting interrupt is exceeded.
|
||||||
|
mov #_uxPortMaxInterruptDepth, r19
|
||||||
|
ld.w 0[r19], r15
|
||||||
|
cmp r15, r16
|
||||||
|
bge 4 ; Jump over ei instruction
|
||||||
|
ei
|
||||||
|
jarl _vCommonISRHandler, lp
|
||||||
|
di
|
||||||
|
synce
|
||||||
|
|
||||||
|
popsp r17, r19
|
||||||
|
st.w r18, 0[r19] ; Restore the old nesting count.
|
||||||
|
|
||||||
|
; A context switch if no nesting interrupt.
|
||||||
|
cmp 0x0, r18
|
||||||
|
bne _vIrq_Handler_NotSwitchContext
|
||||||
|
|
||||||
|
; Check if context switch is requested.
|
||||||
|
mov #_xPortScheduleStatus, r19
|
||||||
|
add r17, r19
|
||||||
|
ld.w 0[r19], r18
|
||||||
|
cmp r0, r18
|
||||||
|
bne _vIrq_Handler_SwitchContext
|
||||||
|
|
||||||
|
_vIrq_Handler_NotSwitchContext:
|
||||||
|
; No context switch. Restore used registers
|
||||||
|
RESTORE_REGISTER
|
||||||
|
eiret
|
||||||
|
|
||||||
|
;This sequence is executed for primary core only to switch context
|
||||||
|
_vIrq_Handler_SwitchContext:
|
||||||
|
; Clear the context switch pending flag.
|
||||||
|
st.w r0, 0[r19]
|
||||||
|
|
||||||
|
add -1, r18
|
||||||
|
bnz _vIrq_Handler_StartFirstTask
|
||||||
|
; Restore used registers before saving the context to the task stack.
|
||||||
|
RESTORE_REGISTER
|
||||||
|
portSAVE_CONTEXT
|
||||||
|
|
||||||
|
; Get Core ID and pass to vTaskSwitchContext as parameter (CCRH compiler)
|
||||||
|
; The parameter is unused in single core, no problem with this redudant setting
|
||||||
|
jarl _xPortGET_CORE_ID, lp ; return value is contained in r10 (CCRH compiler)
|
||||||
|
mov r10, r6
|
||||||
|
|
||||||
|
; vPortYeild may be called to current core again at the end of vTaskSwitchContext.
|
||||||
|
; This may case nested interrupt, however, it is not necessary to set
|
||||||
|
; uxInterruptNesting (currently 0) for trap0 exception. The user interrupt
|
||||||
|
; (EI level interrupt) is not accepted inside of trap0 exception.
|
||||||
|
jarl _vTaskSwitchContext, lp ;
|
||||||
|
portRESTORE_CONTEXT
|
||||||
|
eiret
|
||||||
|
|
||||||
|
_vIrq_Handler_StartFirstTask:
|
||||||
|
RESTORE_REGISTER
|
||||||
|
jr _vPortStartFirstTask
|
||||||
|
|
193
portable/CCRH/F1Kx/portmacro.h
Normal file
193
portable/CCRH/F1Kx/portmacro.h
Normal file
|
@ -0,0 +1,193 @@
|
||||||
|
/*
|
||||||
|
* FreeRTOS Kernel <DEVELOPMENT BRANCH>
|
||||||
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* https://www.FreeRTOS.org
|
||||||
|
* https://github.com/FreeRTOS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PORTMACRO_H
|
||||||
|
#define PORTMACRO_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Port specific definitions.
|
||||||
|
*
|
||||||
|
* The settings in this file configure FreeRTOS correctly for the
|
||||||
|
* given hardware and compiler.
|
||||||
|
*
|
||||||
|
* These settings should not be altered.
|
||||||
|
*-----------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Type definitions - These are a bit legacy and not really used now, other
|
||||||
|
* than portSTACK_TYPE and portBASE_TYPE. */
|
||||||
|
#define portCHAR char
|
||||||
|
#define portFLOAT float
|
||||||
|
#define portDOUBLE double
|
||||||
|
#define portLONG long
|
||||||
|
#define portSHORT short
|
||||||
|
#define portSTACK_TYPE uint32_t
|
||||||
|
#define portBASE_TYPE long
|
||||||
|
|
||||||
|
typedef portSTACK_TYPE StackType_t;
|
||||||
|
typedef long BaseType_t;
|
||||||
|
typedef unsigned long UBaseType_t;
|
||||||
|
|
||||||
|
/* Defines the maximum time when using a wait command in a task */
|
||||||
|
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
|
||||||
|
typedef uint16_t TickType_t;
|
||||||
|
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||||
|
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
|
||||||
|
typedef uint32_t TickType_t;
|
||||||
|
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||||
|
|
||||||
|
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
|
||||||
|
* not need to be guarded with a critical section. */
|
||||||
|
#define portTICK_TYPE_IS_ATOMIC 1
|
||||||
|
#else
|
||||||
|
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Architecture specifics */
|
||||||
|
|
||||||
|
#define portSTSR( reg ) __stsr( ( reg ) )
|
||||||
|
#define portLDSR( reg, val ) __ldsr( ( reg ), ( val ) )
|
||||||
|
#define portSTSR_CCRH( reg, sel ) __stsr_rh( ( reg ), ( sel ) )
|
||||||
|
#define portSYNCM() __syncm()
|
||||||
|
|
||||||
|
/* Determine the descending of the stack from high address to address */
|
||||||
|
#define portSTACK_GROWTH ( -1 )
|
||||||
|
|
||||||
|
/* Determine the time (in milliseconds) corresponding to each tick */
|
||||||
|
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||||
|
|
||||||
|
/* It is a multiple of 4 (the two lower-order bits of the address = 0),
|
||||||
|
* otherwise it will cause MAE (Misaligned Exception) according to the manual */
|
||||||
|
#define portBYTE_ALIGNMENT ( 4 )
|
||||||
|
|
||||||
|
/* Interrupt control macros. */
|
||||||
|
|
||||||
|
#define portENABLE_INTERRUPTS() __EI() /* Macro to enable all maskable interrupts. */
|
||||||
|
#define portDISABLE_INTERRUPTS() __DI() /* Macro to disable all maskable interrupts. */
|
||||||
|
#define taskENABLE_INTERRUPTS() portENABLE_INTERRUPTS()
|
||||||
|
#define taskDISABLE_INTERRUPTS() portDISABLE_INTERRUPTS()
|
||||||
|
|
||||||
|
/* SMP build which means configNUM_CORES is relevant */
|
||||||
|
#define portSUPPORT_SMP 1
|
||||||
|
|
||||||
|
#define portMAX_CORE_COUNT 2
|
||||||
|
#ifndef configNUMBER_OF_CORES
|
||||||
|
#define configNUMBER_OF_CORES 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
/* Scheduler utilities */
|
||||||
|
|
||||||
|
/* Called at the end of an ISR that can cause a context switch */
|
||||||
|
extern void vPortSetSwitch( BaseType_t xSwitchRequired );
|
||||||
|
|
||||||
|
#define portEND_SWITCHING_ISR( x ) vPortSetSwitch( x )
|
||||||
|
|
||||||
|
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
||||||
|
|
||||||
|
/* Use to transfer control from one task to perform other tasks of
|
||||||
|
* higher priority */
|
||||||
|
extern void vPortYield( void );
|
||||||
|
|
||||||
|
#define portYIELD() vPortYield()
|
||||||
|
#if ( configNUMBER_OF_CORES > 1 )
|
||||||
|
|
||||||
|
/* Return the core ID on which the code is running. */
|
||||||
|
extern BaseType_t xPortGET_CORE_ID();
|
||||||
|
|
||||||
|
#define portGET_CORE_ID() xPortGET_CORE_ID()
|
||||||
|
#define coreid xPortGET_CORE_ID()
|
||||||
|
|
||||||
|
/* Request the core ID x to yield. */
|
||||||
|
extern void vPortYieldCore( uint32_t coreID );
|
||||||
|
|
||||||
|
#define portYIELD_CORE( x ) vPortYieldCore( x )
|
||||||
|
|
||||||
|
#define portENTER_CRITICAL_FROM_ISR() vTaskEnterCriticalFromISR()
|
||||||
|
#define portEXIT_CRITICAL_FROM_ISR( x ) vTaskExitCriticalFromISR( x )
|
||||||
|
|
||||||
|
#endif /* if ( configNUMBER_OF_CORES > 1 ) */
|
||||||
|
|
||||||
|
#if ( configNUMBER_OF_CORES == 1 )
|
||||||
|
#define portGET_ISR_LOCK( xCoreID )
|
||||||
|
#define portRELEASE_ISR_LOCK( xCoreID )
|
||||||
|
#define portGET_TASK_LOCK( xCoreID )
|
||||||
|
#define portRELEASE_TASK_LOCK( xCoreID )
|
||||||
|
#else
|
||||||
|
extern void vPortRecursiveLockAcquire( BaseType_t xCoreID, BaseType_t xFromIsr );
|
||||||
|
extern void vPortRecursiveLockRelease( BaseType_t xCoreID, BaseType_t xFromIsr );
|
||||||
|
|
||||||
|
#define portGET_ISR_LOCK( xCoreID ) vPortRecursiveLockAcquire( ( xCoreID ), pdTRUE )
|
||||||
|
#define portRELEASE_ISR_LOCK( xCoreID ) vPortRecursiveLockRelease( ( xCoreID ), pdTRUE )
|
||||||
|
#define portGET_TASK_LOCK( xCoreID ) vPortRecursiveLockAcquire( ( xCoreID ), pdFALSE )
|
||||||
|
#define portRELEASE_TASK_LOCK( xCoreID ) vPortRecursiveLockRelease( ( xCoreID ), pdFALSE )
|
||||||
|
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
/* Critical section management. */
|
||||||
|
|
||||||
|
/* The critical nesting functions defined within tasks.c */
|
||||||
|
|
||||||
|
extern void vTaskEnterCritical( void );
|
||||||
|
extern void vTaskExitCritical( void );
|
||||||
|
|
||||||
|
/* Macro to mark the start of a critical code region */
|
||||||
|
#define portENTER_CRITICAL() vTaskEnterCritical()
|
||||||
|
|
||||||
|
/* Macro to mark the end of a critical code region */
|
||||||
|
#define portEXIT_CRITICAL() vTaskExitCritical()
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
/* Macros to set and clear the interrupt mask. */
|
||||||
|
portLONG xPortSetInterruptMask();
|
||||||
|
void vPortClearInterruptMask( portLONG );
|
||||||
|
|
||||||
|
#define portSET_INTERRUPT_MASK() xPortSetInterruptMask()
|
||||||
|
#define portCLEAR_INTERRUPT_MASK( x ) vPortClearInterruptMask( ( x ) )
|
||||||
|
#define portSET_INTERRUPT_MASK_FROM_ISR() xPortSetInterruptMask()
|
||||||
|
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) vPortClearInterruptMask( ( x ) )
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||||
|
|
||||||
|
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||||
|
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* PORTMACRO_H */
|
9
portable/CCS/ARM_CM3/port.c
Executable file → Normal file
9
portable/CCS/ARM_CM3/port.c
Executable file → Normal file
|
@ -363,14 +363,21 @@ void xPortSysTickHandler( void )
|
||||||
* save and then restore the interrupt mask value as its value is already
|
* save and then restore the interrupt mask value as its value is already
|
||||||
* known. */
|
* known. */
|
||||||
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
|
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
|
traceISR_ENTER();
|
||||||
{
|
{
|
||||||
/* Increment the RTOS tick. */
|
/* Increment the RTOS tick. */
|
||||||
if( xTaskIncrementTick() != pdFALSE )
|
if( xTaskIncrementTick() != pdFALSE )
|
||||||
{
|
{
|
||||||
|
traceISR_EXIT_TO_SCHEDULER();
|
||||||
|
|
||||||
/* A context switch is required. Context switching is performed in
|
/* A context switch is required. Context switching is performed in
|
||||||
* the PendSV interrupt. Pend the PendSV interrupt. */
|
* the PendSV interrupt. Pend the PendSV interrupt. */
|
||||||
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
|
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
traceISR_EXIT();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
|
||||||
}
|
}
|
||||||
|
@ -662,7 +669,7 @@ void vPortSetupTimerInterrupt( void )
|
||||||
*
|
*
|
||||||
* The following links provide detailed information:
|
* The following links provide detailed information:
|
||||||
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
|
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
|
||||||
* https://www.FreeRTOS.org/FAQHelp.html */
|
* https://www.freertos.org/Why-FreeRTOS/FAQs */
|
||||||
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
|
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,19 @@
|
||||||
|
|
||||||
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
|
#define portNVIC_INT_CTRL_REG ( *( ( volatile uint32_t * ) 0xe000ed04 ) )
|
||||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) do { if( xSwitchRequired != pdFALSE ) portYIELD(); } while( 0 )
|
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if( xSwitchRequired != pdFALSE ) \
|
||||||
|
{ \
|
||||||
|
traceISR_EXIT_TO_SCHEDULER(); \
|
||||||
|
portYIELD(); \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
traceISR_EXIT(); \
|
||||||
|
} \
|
||||||
|
} while( 0 )
|
||||||
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -158,7 +170,7 @@
|
||||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef configASSERT
|
#if ( configASSERT_DEFINED == 1 )
|
||||||
void vPortValidateInterruptPriority( void );
|
void vPortValidateInterruptPriority( void );
|
||||||
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
|
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority()
|
||||||
#endif
|
#endif
|
||||||
|
|
9
portable/CCS/ARM_CM4F/port.c
Executable file → Normal file
9
portable/CCS/ARM_CM4F/port.c
Executable file → Normal file
|
@ -388,14 +388,21 @@ void xPortSysTickHandler( void )
|
||||||
* save and then restore the interrupt mask value as its value is already
|
* save and then restore the interrupt mask value as its value is already
|
||||||
* known. */
|
* known. */
|
||||||
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
|
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
|
traceISR_ENTER();
|
||||||
{
|
{
|
||||||
/* Increment the RTOS tick. */
|
/* Increment the RTOS tick. */
|
||||||
if( xTaskIncrementTick() != pdFALSE )
|
if( xTaskIncrementTick() != pdFALSE )
|
||||||
{
|
{
|
||||||
|
traceISR_EXIT_TO_SCHEDULER();
|
||||||
|
|
||||||
/* A context switch is required. Context switching is performed in
|
/* A context switch is required. Context switching is performed in
|
||||||
* the PendSV interrupt. Pend the PendSV interrupt. */
|
* the PendSV interrupt. Pend the PendSV interrupt. */
|
||||||
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
|
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
traceISR_EXIT();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
|
||||||
}
|
}
|
||||||
|
@ -687,7 +694,7 @@ void vPortSetupTimerInterrupt( void )
|
||||||
*
|
*
|
||||||
* The following links provide detailed information:
|
* The following links provide detailed information:
|
||||||
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
|
* https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
|
||||||
* https://www.FreeRTOS.org/FAQHelp.html */
|
* https://www.freertos.org/Why-FreeRTOS/FAQs */
|
||||||
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
|
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue