On Thursday, September 6, 2018 at 12:05:06 PM UTC+3, Nir Geller wrote:
> Hi there,
>
> I'm developing over Sitara IDK am5728 with TI supplied
> PROCESSOR-SDK-LINUX-AM57X version v05.00 and PROCESSOR-SDK-RTOS-AM57X version
> v05.00.
> I'm using the jailhouse hypervisor and I'm able to run linux on core 0 and on
> core 1 the prebuilt jailhouse inmate demo taken from
> processor_sdk_rtos_am57xx_5_00_00_15/demos/jailhouse-inmate/rtos/icss_emac
> # modprobe jailhouse
> # jailhouse enable /home/root/jail/am57xx-evm.cell
> # jailhouse cell create /usr/share/jailhouse/examples/am572x-rtos-icss.cell
> # jailhouse cell load 1 /usr/share/jailhouse/examples/linux-loader.bin -a 0
> -s "kernel=0x80000000" -a 0x100 /home/root/jail/icss_emac.bin -a 0x80000000
> # jailhouse cell start 1
> When starting the cell I get outputs over UART.
> I can connect over JTAG and see that the memory browser and disassembly show
> exactly what is expected
> according to objdumbing icss_emac.out.
> Now I'm trying to build my own RTOS inmate using PROCESSOR-SDK-RTOS-AM57X
> version v05.00.
> Since I was able to run successfully the icss_emac jailhouse demo I took
> pdk_am57xx_1_0_11/packages/MyExampleProjects/ICSS_EMAC_BasicExample_idkAM572x_wSoCLib_armTestproject
> as a starting point. Before making any changes, when I ran this project using
> JTAG it was working fine and I got its output over UART.
> Now I'm trying to port it into a jailhouse inmate.
> So I followed
> processors.wiki.ti.com/.../Processor_SDK_Jailhouse_Hypervisor
> From what I gather there are 3 main differences between the jailhouse inmate
> and the original sys/bios project:
> compilation flag __JAILHOUSE_INMATE
> board init function
> cfg file
> I tried all kinds of variations like taking the cfg and board_init files from
> demos/jailhouse-inmate/rtos/icss_emac/src and add to
> ICSS_EMAC_BasicExample_idkAM572x_wSoCLib_armTestproject.
> I added the compilation flag __JAILHOUSE_INMATE
> but so far I wasn't able to create a .bin file that I could start up as an
> inmate on core 1.
> I created an inmate cell with:
> # modprobe jailhouse
> # jailhouse enable /home/root/jail/am57xx-evm.cell
> # jailhouse cell create /usr/share/jailhouse/examples/am572x-rtos-icss.cell
> Copied the app product from
> ICSS_EMAC_BasicExample_idkAM572x_wSoCLib_armTestproject and loaded it.
> By objdumping the .out I found that the entry point is 0x80001000
> # jailhouse cell load 1 /usr/share/jailhouse/examples/linux-loader.bin -a 0
> -s "kernel=0x80001000" -a 0x100 /home/root/jail/app -a 0x80000000
> # jailhouse cell start 1
> At this point I get no output over UART.
> The disassembly of .out (attached) looks like
> Disassembly of section .c_int00:
> 80001000 <_c_int00>:
> 80001000: e10f0000 mrs r0, CPSR
> 80001004: e380c0c0 orr ip, r0, #192 ; 0xc0
> ....
> ....
> Disassembly of section .text:
> 80001590 <UART_socGetInitCfg>:
> 80001590: e16d41f0 strd r4, [sp, #-16]!
> 80001594: e58d6008 str r6, [sp, #8]
> 80001598: e58de00c str lr, [sp, #12]
> ....
> ....
>
> When using JTAG to inspect the memory it seems like the file was loaded to
> 0x80000048
> And the text section starts from 0x800001Ec (see attached picture)
>
> What can I do to start up this project as a jailhouse inmate?
> Any assist would be great.
>
> Thanks a lot,
>
> Nir.
Attached is an example of a configuration file that allows an RTOS project to
run as an inmate, and a substitute function to init the board.
The basic idea is to prevent any board_init procedures, as they were already
executed by Linux, and to create a bin file that uses contiguous memory
starting from 0x80000000.
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory')
var SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
/*==================== Inmate ====================*/
var TimerSupport = xdc.module('ti.sysbios.family.shared.vayu.TimerSupport');
TimerSupport.availMask = 0x0080;
/*================================================*/
/*
* Uncomment this line to globally disable Asserts.
* All modules inherit the default from the 'Defaults' module. You
* can override these defaults on a per-module basis using Module.common$.
* Disabling Asserts will save code space and improve runtime performance.
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
*/
/*
* Uncomment this line to keep module names from being loaded on the target.
* The module name strings are placed in the .const section. Setting this
* parameter to false will save space in the .const section. Error and
* Assert messages will contain an "unknown module" prefix instead
* of the actual module name.
Defaults.common$.namedModule = false;
*/
/*
* Minimize exit handler array in System. The System module includes
* an array of functions that are registered with System_atexit() to be
* called by System_exit().
*/
System.maxAtexitHandlers = 4;
/*
* Uncomment this line to disable the Error print function.
* We lose error information when this is disabled since the errors are
* not printed. Disabling the raiseHook will save some code space if
* your app is not using System_printf() since the Error_print() function
* calls System_printf().
Error.raiseHook = null;
*/
/*
* Uncomment this line to keep Error, Assert, and Log strings from being
* loaded on the target. These strings are placed in the .const section.
* Setting this parameter to false will save space in the .const section.
* Error, Assert and Log message will print raw ids and args instead of
* a formatted message.
Text.isLoaded = false;
*/
/*
* Uncomment this line to disable the output of characters by SysMin
* when the program exits. SysMin writes characters to a circular buffer.
* This buffer can be viewed using the SysMin Output view in ROV.
SysMin.flushAtExit = false;
*/
/* System stack size (used by ISRs and Swis) */
Program.stack = 0x2000;
/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;
/*
* Create and install logger for the whole system
*/
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.numEntries = 16;
var logger0 = LoggerBuf.create(loggerBufParams);
Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;
System.SupportProxy = SysMin;
/* ================ BIOS configuration ================ */
var BIOS = xdc.useModule('ti.sysbios.BIOS');
/*
* Build a custom SYS/BIOS library from sources.
*/
BIOS.libType = BIOS.LibType_Custom;
BIOS.heapSize = 0x10000;
/* ================ Driver configuration ================ */
/* Load the OSAL package */
var osType = "tirtos";
var Osal = xdc.loadPackage('ti.osal');
Osal.Settings.osType = osType;
/*use CSL package*/
var socType = "am572x";
var Csl = xdc.loadPackage('ti.csl');
Csl.Settings.deviceType = socType;
/* Load the uart package */
var Uart = xdc.loadPackage('ti.drv.uart');
Uart.Settings.socType = socType;
/* Load the I2C package */
//var I2c = xdc.loadPackage('ti.drv.i2c');
//I2c.Settings.socType = socType;
/* Load the SPI package */
//var Spi = xdc.loadPackage('ti.drv.spi');
/* Load the Board package and set the board name */
//var Board = xdc.loadPackage('ti.board');
//Board.Settings.boardName = "idkAM572x";
/* ================ Cache and MMU configuration ================ */
var Cache1 = xdc.useModule('ti.sysbios.family.arm.a15.Cache');
var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');
/* Enable the cache */
Cache1.enableCache = true;
/* Enable the MMU (Required for L1 data caching) */
Mmu.enableMMU = true;
var attrs = new Mmu.DescriptorAttrs();
Mmu.initDescAttrsMeta(attrs);
attrs.type = Mmu.DescriptorType_BLOCK;
attrs.noExecute = true;
attrs.accPerm = 0; // R/W at PL1
attrs.attrIndx = 4; // Use MAIR0 Byte2
Mmu.setMAIRMeta(4, 0x04);
Mmu.setSecondLevelDescMeta(0x43200000, 0x43200000, attrs);
/* Set IO Delay configuration areas as non-cache */
attrs.attrIndx = 1;
Mmu.setSecondLevelDescMeta(0x4844a000, 0x4844a000, attrs);
Mmu.setSecondLevelDescMeta(0x4ae07d00, 0x4ae07d00, attrs);
/* ================ Memory sections configuration ================ */
//Program.sectMap["BOARD_IO_DELAY_DATA"] = "OCMC_RAM1";
//Program.sectMap["BOARD_IO_DELAY_CODE"] = "OCMC_RAM1";
/* ================= Inmate ====================================== */
var Cache = xdc.useModule("ti.sysbios.family.arm.a15.Cache");
Cache.errata798870 = false;
var Hwi = xdc.useModule('ti.sysbios.family.arm.gic.Hwi');
Hwi.initGicd = false;
/******************************************************************************
* Copyright (c) 2017 Texas Instruments Incorporated - http://www.ti.com
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#include <ti/csl/csl_types.h>
#include <ti/csl/cslr_device.h>
#include <ti/drv/uart/UART.h>
#include <ti/drv/uart/UART_stdio.h>
//#include <ti/board/board.h>
#include <ti/board/src/idkAM572x/include/board_internal.h>
#include <ti/csl/soc/am572x/src/cslr_soc.h>
Board_STATUS Board_moduleClockInit();
Board_STATUS Board_init(Board_initCfg cfg)
{
Board_STATUS ret = BOARD_SOK;
if (cfg & BOARD_INIT_MODULE_CLOCK)
ret = Board_moduleClockInit();
if (ret != BOARD_SOK)
return ret;
if (cfg & BOARD_INIT_UART_STDIO)
UART_stdioInit(2);
if (ret != BOARD_SOK)
return ret;
return ret;
}
Board_STATUS Board_moduleClockInit()
{
CSL_l4per_cm_core_componentRegs *l4PerCmReg =
(CSL_l4per_cm_core_componentRegs *) CSL_MPU_L4PER_CM_CORE_REGS;
CSL_FINST(l4PerCmReg->CM_L4PER2_PRUSS1_CLKCTRL_REG,
L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS1_CLKCTRL_REG_MODULEMODE, DISABLED);
CSL_FINST(l4PerCmReg->CM_L4PER2_PRUSS1_CLKCTRL_REG,
L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS1_CLKCTRL_REG_MODULEMODE, ENABLE);
while(CSL_L4PER_CM_CORE_COMPONENT_CM_L4PER2_L4_PER2_CLKCTRL_REG_IDLEST_FUNC !=
CSL_FEXT(l4PerCmReg->CM_L4PER2_PRUSS1_CLKCTRL_REG,
L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS1_CLKCTRL_REG_IDLEST));
CSL_FINST(l4PerCmReg->CM_L4PER2_PRUSS2_CLKCTRL_REG,
L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS2_CLKCTRL_REG_MODULEMODE, DISABLED);
CSL_FINST(l4PerCmReg->CM_L4PER2_PRUSS2_CLKCTRL_REG,
L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS2_CLKCTRL_REG_MODULEMODE, ENABLE);
while(CSL_L4PER_CM_CORE_COMPONENT_CM_L4PER2_L4_PER2_CLKCTRL_REG_IDLEST_FUNC !=
CSL_FEXT(l4PerCmReg->CM_L4PER2_PRUSS2_CLKCTRL_REG,
L4PER_CM_CORE_COMPONENT_CM_L4PER2_PRUSS2_CLKCTRL_REG_IDLEST));
return BOARD_SOK;
}