FreeCalypso > hg > fc-tourmaline
annotate components/nucleus_flash @ 220:0ed36de51973
ABB semaphore protection overhaul
The ABB semaphone protection logic that came with TCS211 from TI
was broken in several ways:
* Some semaphore-protected functions were called from Application_Initialize()
context. NU_Obtain_Semaphore() called with NU_SUSPEND fails with
NU_INVALID_SUSPEND in this context, but the return value wasn't checked,
and NU_Release_Semaphore() would be called unconditionally at the end.
The latter call would increment the semaphore count past 1, making the
semaphore no longer binary and thus no longer effective for resource
protection. The fix is to check the return value from NU_Obtain_Semaphore()
and skip the NU_Release_Semaphore() call if the semaphore wasn't properly
obtained.
* Some SPI hardware manipulation was being done before entering the semaphore-
protected critical section. The fix is to reorder the code: first obtain
the semaphore, then do everything else.
* In the corner case of L1/DSP recovery, l1_abb_power_on() would call some
non-semaphore-protected ABB & SPI init functions. The fix is to skip those
calls in the case of recovery.
* A few additional corner cases existed, all of which are fixed by making
ABB semaphore protection 100% consistent for all ABB functions and code paths.
There is still one remaining problem of priority inversion: suppose a low-
priority task calls an ABB function, and some medium-priority task just happens
to preempt right in the middle of that semaphore-protected ABB operation. Then
the high-priority SPI task is locked out for a non-deterministic time until
that medium-priority task finishes its work and goes back to sleep. This
priority inversion problem remains outstanding for now.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 26 Apr 2021 20:55:25 +0000 |
parents | 572c3ee87676 |
children |
rev | line source |
---|---|
30
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 # New Tourmaline component: compiling Nucleus from source (XIP) |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 CFLAGS="-mn -me -mt -o -mw" |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 CPPFLAGS= |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 SRCDIR=$SRC/nucleus |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 cfile_plain $SRCDIR/dmce.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 cfile_plain $SRCDIR/dmd.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 cfile_plain $SRCDIR/dmf.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 cfile_plain $SRCDIR/dmi.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 cfile_plain $SRCDIR/dms.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 cfile_plain $SRCDIR/erc.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 cfile_plain $SRCDIR/erd.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 cfile_plain $SRCDIR/eri.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 cfile_plain $SRCDIR/evc.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 cfile_plain $SRCDIR/evce.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 cfile_plain $SRCDIR/evd.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 cfile_plain $SRCDIR/evf.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 cfile_plain $SRCDIR/evi.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 cfile_plain $SRCDIR/hic.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 cfile_plain $SRCDIR/hid.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 cfile_plain $SRCDIR/hii.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 cfile_plain $SRCDIR/inc.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 cfile_plain $SRCDIR/ioc.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 cfile_plain $SRCDIR/ioce.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 cfile_plain $SRCDIR/iod.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 cfile_plain $SRCDIR/iof.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 cfile_plain $SRCDIR/ioi.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 cfile_plain $SRCDIR/lic.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 cfile_plain $SRCDIR/lid.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 cfile_plain $SRCDIR/mbc.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 cfile_plain $SRCDIR/mbce.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 cfile_plain $SRCDIR/mbd.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 cfile_plain $SRCDIR/mbf.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 cfile_plain $SRCDIR/mbi.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 cfile_plain $SRCDIR/mbs.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 cfile_plain $SRCDIR/mbse.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 cfile_plain $SRCDIR/pic.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 cfile_plain $SRCDIR/pice.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 cfile_plain $SRCDIR/pid.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 cfile_plain $SRCDIR/pif.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 cfile_plain $SRCDIR/pii.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 cfile_plain $SRCDIR/pis.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 cfile_plain $SRCDIR/pise.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 cfile_plain $SRCDIR/pmf.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 cfile_plain $SRCDIR/pmi.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 cfile_plain $SRCDIR/quc.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 cfile_plain $SRCDIR/quce.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 cfile_plain $SRCDIR/qud.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 cfile_plain $SRCDIR/quf.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 cfile_plain $SRCDIR/qui.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 cfile_plain $SRCDIR/qus.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 cfile_plain $SRCDIR/quse.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 cfile_plain $SRCDIR/rlc.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 cfile_plain $SRCDIR/rld.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 cfile_plain $SRCDIR/smf.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 cfile_plain $SRCDIR/smi.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 cfile_plain $SRCDIR/sms.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 cfile_plain $SRCDIR/smse.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 cfile_plain $SRCDIR/tcf.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 cfile_plain $SRCDIR/tcfe.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 cfile_plain $SRCDIR/tci.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 cfile_plain $SRCDIR/tcs.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 cfile_plain $SRCDIR/tcse.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 cfile_plain $SRCDIR/tmf.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 cfile_plain $SRCDIR/tmi.c |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 # TCS211 version of Nucleus has dmc.c compiled without -o |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 CFLAGS="-mn -me -mt -mw" |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 |
572c3ee87676
components/nucleus_{flash,intram}: ported from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 cfile_plain $SRCDIR/dmc.c |