summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Andrianov2017-05-10 10:11:18 -0500
committerVitaly Andrianov2017-05-17 09:34:45 -0500
commitbcaa4a1684f79c794aca864838d9b34e13c05e31 (patch)
treec2b9321d12f7707d4d51b20b49a7f138c776ffbc
parentbe0c878adb6307d5c0cc1006c822a8a6bd7fa47b (diff)
downloadjailhouse-inmate-bcaa4a1684f79c794aca864838d9b34e13c05e31.tar.gz
jailhouse-inmate-bcaa4a1684f79c794aca864838d9b34e13c05e31.tar.xz
jailhouse-inmate-bcaa4a1684f79c794aca864838d9b34e13c05e31.zip
jailhouse: add pru-icss test inmate
This commit adds the pru-icss test application inmate. The application reuses PDK sources located at the (PDK)/packages/ti/drv/pruss/test directoy. It has its own pruss_arm_wSoCLib.cfg file, which is a modified copy of the (PDK)/packages/ti/drv/pruss/test/am572x/armv7/bios/pruss_arm_wSoCLib.cfg The application doesn't use board and i2c pdk's libraries. It has it's own Board_init() and other necessary functions, implemented in the idkAM572x_jh.c NOTE: 1) Linux DTS file shall reserve GIC interrupt line used by this app 2) debug UART must work in polling mode. Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
-rw-r--r--rtos/pru-icss/Makefile64
-rw-r--r--rtos/pru-icss/bios/makefile23
-rwxr-xr-xrtos/pru-icss/bios/pruss_arm_wSoCLib.cfg197
-rw-r--r--rtos/pru-icss/src/idkAM572x_jh.c84
4 files changed, 368 insertions, 0 deletions
diff --git a/rtos/pru-icss/Makefile b/rtos/pru-icss/Makefile
new file mode 100644
index 0000000..12576b9
--- /dev/null
+++ b/rtos/pru-icss/Makefile
@@ -0,0 +1,64 @@
1EXE = pruss
2
3#**** rules.mk ***************************************************************
4
5CROSS_COMPILE = arm-none-eabi-
6CC=$(CROSS_COMPILE)gcc
7LD=$(CROSS_COMPILE)gcc
8AR=$(CROSS_COMPILE)ar
9BIN=$(CROSS_COMPILE)objcopy
10OBJDUMP=$(CROSS_COMPILE)objdump
11BINFLAGS=-O binary
12
13OBJS = $(patsubst %.c,%.o,$(CSRCS))
14OBJS += $(patsubst %.S,%.o,$(ASRCS))
15
16GCCOPT = -gdwarf-3 -gstrict-dwarf -Wall -mtune=cortex-a15 \
17 -marm -mfloat-abi=hard \
18 -g -MMD -MP \
19 -DSOC_AM572x
20
21LDIR=-L"/home/a0794637/ti/bios_6_46_04_53/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu"
22
23INCDIRS = -I$(XDC_INSTALL_PATH)/packages \
24 -I$(BIOS_INSTALL_PATH)/packages \
25 -I$(PDK_INSTALL_PATH)
26
27XDC_OPT = -Dxdc_target_types__="gnu/targets/arm/std.h" \
28 -Dxdc_target_name__=A15F
29
30CFLAGS = $(GCCOPT) -g $(INCDIRS) $(XDC_OPT) -mcpu=cortex-a15 \
31 -D__JAILHOUSE_INMATE=1
32
33LDFLAGS= $(GCCOPT) -Dam5728 -Dcore0 \
34 -Wl,-Map,$(EXE).map -nostartfiles \
35 -static -Wl,--gc-sections $(LDIR) \
36 -Wl,--defsym,CORE0=1 \
37 -Wl,--defsym,STACKSIZE=0x10000 -Wl,--defsym,HEAPSIZE=0x400 \
38 -Wl,-T$(LDS) -Wl,--start-group -lgcc -lm -lnosys -lc -Wl,--end-group
39
40#******************************************************************************
41
42VPATH = $(PDK_INSTALL_PATH)/ti/drv/uart/soc/am572x/
43VPATH += $(PDK_INSTALL_PATH)/ti/drv/pruss/test/src/
44VPATH += ./src/
45
46CSRCS = main.c idkAM572x_jh.c UART_soc.c
47
48LDS = ./bios/configPkg/linker.cmd
49
50all: $(EXE).bin
51
52$(EXE).out: $(LDS) $(OBJS)
53 $(LD) $(OBJS) $(LDFLAGS) -o $@
54
55$(EXE).bin: $(EXE).out
56 $(BIN) $(BINFLAGS) $< $@
57
58$(LDS):
59 $(MAKE) -C ./bios sysbios
60
61clean:
62 $(MAKE) -C ./bios clean
63 rm -rf *.o *.map *.a *.bin *.out *.d
64
diff --git a/rtos/pru-icss/bios/makefile b/rtos/pru-icss/bios/makefile
new file mode 100644
index 0000000..4026b06
--- /dev/null
+++ b/rtos/pru-icss/bios/makefile
@@ -0,0 +1,23 @@
1
2XS=$(XDC_INSTALL_PATH)/xs
3__XDCPATH=\
4$(BIOS_INSTALL_PATH)/packages;\
5$(PDK_INSTALL_PATH);\
6$(EDMA3LLD_BIOS6_INSTALLDIR)/packages;\
7$(IPC_INSTALL_PATH)/packages;\
8$(NDK_INSTALL_PATH)/packages;\
9$(UIA_INSTALL_PATH)/packages;\
10$(HOME)/ti/ccsv7/ccs_base
11
12.PHONY: sysbios clean ppp
13
14sysbios:
15 $(XS) --xdcpath="$(subst ; ,;,$(__XDCPATH))" xdc.tools.configuro \
16 -o configPkg -t gnu.targets.arm.A15F \
17 -p ti.platforms.idkAM572X -r debug \
18 -c "$(TOOLCHAIN_PATH_A15)" \
19 "./pruss_arm_wSoCLib.cfg"
20
21clean:
22 rm -rf configPkg src
23
diff --git a/rtos/pru-icss/bios/pruss_arm_wSoCLib.cfg b/rtos/pru-icss/bios/pruss_arm_wSoCLib.cfg
new file mode 100755
index 0000000..14ee706
--- /dev/null
+++ b/rtos/pru-icss/bios/pruss_arm_wSoCLib.cfg
@@ -0,0 +1,197 @@
1/**
2 * \file pruss_arm_wSoCLib.cfg
3 *
4 * \brief Sysbios config file for pruss example project on AM572X IDK EVM.
5 *
6 */
7
8/*
9 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 *
18 * Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the
21 * distribution.
22 *
23 * Neither the name of Texas Instruments Incorporated nor the names of
24 * its contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 */
40/* ================ General configuration ================ */
41var Defaults = xdc.useModule('xdc.runtime.Defaults');
42var Diags = xdc.useModule('xdc.runtime.Diags');
43var Error = xdc.useModule('xdc.runtime.Error');
44var Log = xdc.useModule('xdc.runtime.Log');
45var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
46var Main = xdc.useModule('xdc.runtime.Main');
47var Memory = xdc.useModule('xdc.runtime.Memory')
48var System = xdc.useModule('xdc.runtime.System');
49var Text = xdc.useModule('xdc.runtime.Text');
50var BIOS = xdc.useModule('ti.sysbios.BIOS');
51var Clock = xdc.useModule('ti.sysbios.knl.Clock');
52var Swi = xdc.useModule('ti.sysbios.knl.Swi');
53var Task = xdc.useModule('ti.sysbios.knl.Task');
54var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
55var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
56var InitXbar = xdc.useModule("ti.sysbios.family.shared.vayu.IntXbar");
57SysStd = xdc.useModule('xdc.runtime.SysStd');
58var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
59var ti_sysbios_family_arm_gic_Hwi = xdc.useModule('ti.sysbios.family.arm.gic.Hwi');
60var Program = xdc.useModule("xdc.cfg.Program");
61
62/*
63 * Program.argSize sets the size of the .args section.
64 * The examples don't use command line args so argSize is set to 0.
65 */
66Program.argSize = 0x0;
67//Program.heap = 0x10000;
68
69/* System stack size (used by ISRs and Swis) */
70Program.stack = 0x20000;
71
72/*
73 * Uncomment this line to globally disable Asserts.
74 * All modules inherit the default from the 'Defaults' module. You
75 * can override these defaults on a per-module basis using Module.common$.
76 * Disabling Asserts will save code space and improve runtime performance.
77Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
78 */
79
80/*
81 * Uncomment this line to keep module names from being loaded on the target.
82 * The module name strings are placed in the .const section. Setting this
83 * parameter to false will save space in the .const section. Error and
84 * Assert messages will contain an "unknown module" prefix instead
85 * of the actual module name.
86Defaults.common$.namedModule = false;
87 */
88
89/*
90 * Minimize exit handler array in System. The System module includes
91 * an array of functions that are registered with System_atexit() to be
92 * called by System_exit().
93 */
94/*System.maxAtexitHandlers = 4;*/
95
96/*
97 * Uncomment this line to disable the Error print function.
98 * We lose error information when this is disabled since the errors are
99 * not printed. Disabling the raiseHook will save some code space if
100 * your app is not using System_printf() since the Error_print() function
101 * calls System_printf().
102Error.raiseHook = null;
103 */
104
105/*
106 * Uncomment this line to keep Error, Assert, and Log strings from being
107 * loaded on the target. These strings are placed in the .const section.
108 * Setting this parameter to false will save space in the .const section.
109 * Error, Assert and Log message will print raw ids and args instead of
110 * a formatted message.
111Text.isLoaded = false;
112 */
113
114/* ================ BIOS configuration ================ */
115
116var BIOS = xdc.useModule('ti.sysbios.BIOS');
117/*
118 * Build a custom SYS/BIOS library from sources.
119 */
120BIOS.libType = BIOS.LibType_Custom;
121
122/*
123 * The BIOS module will create the default heap for the system.
124 * Specify the size of this default heap.
125 */
126BIOS.heapSize = 0x1000;
127
128/* ================ Task configuration ================ */
129
130var taskParams = new Task.Params();
131taskParams.instance.name = "patchTask";
132taskParams.stackSize = 1024;
133Program.global.patchTask = Task.create("&eventwait", taskParams);
134
135/* ================ Driver configuration ================ */
136var socType = "am572x";
137var Csl = xdc.loadPackage('ti.csl');
138Csl.Settings.deviceType = socType;
139
140/* Load the OSAL package */
141var osType = "tirtos"
142var Osal = xdc.useModule('ti.osal.Settings');
143Osal.osType = osType;
144Osal.socType = socType;
145
146/* Load the pruss package */
147var Pruss = xdc.loadPackage('ti.drv.pruss');
148Pruss.Settings.socType = socType;
149
150/* Load the UART package */
151var UART = xdc.loadPackage('ti.drv.uart');
152
153/* ================ Cache and MMU configuration ================ */
154
155var Cache1 = xdc.useModule('ti.sysbios.family.arm.a15.Cache');
156var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');
157
158/* Enable the cache */
159Cache1.enableCache = true;
160
161/* Enable the MMU (Required for L1 data caching) */
162Mmu.enableMMU = true;
163
164var attrs = new Mmu.DescriptorAttrs();
165Mmu.initDescAttrsMeta(attrs);
166attrs.type = Mmu.DescriptorType_BLOCK;
167attrs.noExecute = true;
168attrs.accPerm = 0; // R/W at PL1
169//attrs.attrIndx = 4; // Use MAIR0 Byte2
170Mmu.setMAIRMeta(4, 0x04);
171//Mmu.setSecondLevelDescMeta(0x43200000, 0x43200000, attrs);
172
173/* Set IO Delay configuration areas as non-cache */
174attrs.attrIndx = 1;
175Mmu.setSecondLevelDescMeta(0x4844a000, 0x4844a000, attrs);
176Mmu.setSecondLevelDescMeta(0x4ae07d00, 0x4ae07d00, attrs);
177
178var attrs1 = new Mmu.DescriptorAttrs();
179Mmu.initDescAttrsMeta(attrs1);
180attrs1.type = Mmu.DescriptorType_BLOCK;
181attrs1.noExecute = true;
182attrs1.accPerm = 0; // R/W at PL1
183attrs1.attrIndx = 4; // Use MAIR0 Byte2
184Mmu.setMAIRMeta(4, 0x04);
185Mmu.setSecondLevelDescMeta(0x4b200000, 0x4b200000, attrs1);
186
187/* ================ Memory sections configuration ================ */
188//Program.sectMap["BOARD_IO_DELAY_DATA"] = "OCMC_RAM1";
189//Program.sectMap["BOARD_IO_DELAY_CODE"] = "OCMC_RAM1";
190//
191/* ================= Inmate ====================================== */
192var Cache = xdc.useModule("ti.sysbios.family.arm.a15.Cache");
193Cache.errata798870 = false;
194
195var Hwi = xdc.useModule('ti.sysbios.family.arm.gic.Hwi');
196Hwi.initGicd = false;
197
diff --git a/rtos/pru-icss/src/idkAM572x_jh.c b/rtos/pru-icss/src/idkAM572x_jh.c
new file mode 100644
index 0000000..716fcaa
--- /dev/null
+++ b/rtos/pru-icss/src/idkAM572x_jh.c
@@ -0,0 +1,84 @@
1/******************************************************************************
2 * Copyright (c) 2017 Texas Instruments Incorporated - http://www.ti.com
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * distribution.
15 *
16 * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *****************************************************************************/
33
34#include <ti/csl/csl_types.h>
35#include <ti/csl/cslr_device.h>
36
37#include <ti/drv/uart/UART.h>
38#include <ti/drv/uart/UART_stdio.h>
39#include <ti/board/board.h>
40
41Board_STATUS Board_moduleClockInit();
42
43Board_STATUS Board_init(Board_initCfg cfg)
44{
45 Board_STATUS ret = BOARD_SOK;
46
47 if (cfg & BOARD_INIT_MODULE_CLOCK)
48 ret = Board_moduleClockInit();
49 if (ret != BOARD_SOK)
50 return ret;
51
52 if (cfg & BOARD_INIT_UART_STDIO)
53 UART_stdioInit(2);
54
55 return ret;
56}
57
58Board_STATUS Board_moduleClockInit()
59{
60 CSL_l4per_cm_core_componentRegs *l4PerCmReg =
61 (CSL_l4per_cm_core_componentRegs *) CSL_MPU_L4PER_CM_CORE_REGS;
62
63 CSL_FINST(l4PerCmReg->CM_L4PER2_PRUSS1_CLKCTRL_REG,
64 L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS1_CLKCTRL_REG_MODULEMODE, DISABLED);
65
66 CSL_FINST(l4PerCmReg->CM_L4PER2_PRUSS1_CLKCTRL_REG,
67 L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS1_CLKCTRL_REG_MODULEMODE, ENABLE);
68
69 while(CSL_L4PER_CM_CORE_COMPONENT_CM_L4PER2_L4_PER2_CLKCTRL_REG_IDLEST_FUNC !=
70 CSL_FEXT(l4PerCmReg->CM_L4PER2_PRUSS1_CLKCTRL_REG,
71 L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS1_CLKCTRL_REG_IDLEST));
72
73 CSL_FINST(l4PerCmReg->CM_L4PER2_PRUSS2_CLKCTRL_REG,
74 L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS2_CLKCTRL_REG_MODULEMODE, DISABLED);
75
76 CSL_FINST(l4PerCmReg->CM_L4PER2_PRUSS2_CLKCTRL_REG,
77 L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS2_CLKCTRL_REG_MODULEMODE, ENABLE);
78
79 while(CSL_L4PER_CM_CORE_COMPONENT_CM_L4PER2_L4_PER2_CLKCTRL_REG_IDLEST_FUNC !=
80 CSL_FEXT(l4PerCmReg->CM_L4PER2_PRUSS2_CLKCTRL_REG,
81 L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS2_CLKCTRL_REG_IDLEST));
82
83 return BOARD_SOK;
84}