annotate components/frame_fl @ 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 e58a5bb12de4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 # Building frame_fl.lib using a mixture of source and blobs as configured
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 CFLAGS="-mw -x -pw2 -o3 -me -mt -g -mn"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 # Defines
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 CPPFLAGS="-DNU_DEBUG -D_FF_RV_EXIST_ -DRUN_FLASH"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 CPPFLAGS="$CPPFLAGS -D_TARGET_ -D_NUCLEUS_"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
38
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
10 if [ "$MEMSUPER" != 0 ]
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
11 then
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
12 CPPFLAGS="$CPPFLAGS -DMEMORY_SUPERVISION"
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
13 fi
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
14 if [ "$MEMSUPER" = 2 ]
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
15 then
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
16 CPPFLAGS="$CPPFLAGS -DOPTIMIZE_POOL"
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
17 fi
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
18
29
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 # Includes
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 CPPFLAGS="$CPPFLAGS -I$SRC/gpf/frame"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 CPPFLAGS="$CPPFLAGS -I$SRC/gpf/inc/nuc"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 CPPFLAGS="$CPPFLAGS -I$SRC/nucleus"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 CPPFLAGS="$CPPFLAGS -I$SRC/gpf/inc"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 CPPFLAGS="$CPPFLAGS -I$SRC/gpf/tst"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 # Source modules
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 SRCDIR=$SRC/gpf/frame
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 cfile_symlink $SRCDIR/frame.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 cfile_symlink $SRCDIR/vsi_sem.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 cfile_symlink $SRCDIR/vsi_com.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 cfile_symlink $SRCDIR/vsi_mem.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 cfile_symlink $SRCDIR/vsi_tim.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 cfile_symlink $SRCDIR/vsi_mis.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 cfile_symlink $SRCDIR/vsi_drv.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 cfile_symlink $SRCDIR/vsi_trc.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 cfile_symlink $SRCDIR/vsi_pro.c
38
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
40 if [ "$MEMSUPER" != 0 ]
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
41 then
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
42 cfile_symlink $SRCDIR/vsi_ppm.c
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
43 fi
29
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 cfile_symlink $SRCDIR/xalert.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 cfile_symlink $SRCDIR/route.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 cfile_symlink $SRCDIR/prf_func.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 cfile_symlink $SRCDIR/frm_ext.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 cfile_symlink $SRCDIR/frame_version.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 # OSL
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 if [ "$OSL" = 1 ]
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 then
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 # drop -o3
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 CFLAGS="-mw -x -pw2 -o -me -mt -g -mn"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 SRCDIR=$SRC/gpf/osl
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 cfile_plain $SRCDIR/os_com_fl.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 cfile_plain $SRCDIR/os_drv.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 cfile_plain $SRCDIR/os_isr.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 cfile_plain $SRCDIR/os_mem_fl.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 cfile_plain $SRCDIR/os_mis_fl.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 cfile_plain $SRCDIR/os_pro_fl.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 cfile_plain $SRCDIR/os_sem_fl.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 cfile_plain $SRCDIR/os_tim_fl.c
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 else
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 OBJDIR=../../blobs/osl/fl
38
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
72 OBJDIR_PS=../../blobs/osl/fl_ps
29
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 OBJS="$OBJS $OBJDIR/os_com.obj"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 OBJS="$OBJS $OBJDIR/os_drv.obj"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 OBJS="$OBJS $OBJDIR/os_evt.obj"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 OBJS="$OBJS $OBJDIR/os_isr.obj"
38
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
78 if [ "$MEMSUPER" != 0 ]
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
79 then
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
80 OBJS="$OBJS $OBJDIR_PS/os_mem.obj"
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
81 OBJS="$OBJS $OBJDIR_PS/os_mis.obj"
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
82 else
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
83 OBJS="$OBJS $OBJDIR/os_mem.obj"
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
84 OBJS="$OBJS $OBJDIR/os_mis.obj"
e58a5bb12de4 experimental support for GPF memory supervision
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
85 fi
29
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 OBJS="$OBJS $OBJDIR/os_pro.obj"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 OBJS="$OBJS $OBJDIR/os_sem.obj"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 OBJS="$OBJS $OBJDIR/os_tim.obj"
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89
9ab2f6dc1974 components/frame_{fl,ir} crafted
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 fi