RPMsg BIOS Sources

From OMAPpedia

Jump to: navigation, search

RPMsg code is split into a host processor side and remote processor side code. While the host-side code is running as part of the Linux kernel, the remote processor/coprocessor-side code, runs on top of a RTOS, SYS/BIOS and is referred to as SYS/BIOS RPMsg. This page gives all the information about the SYS/BIOS RPMsg source code including the necessary tools information, their download and build instructions.


[edit] Prerequisites

Here is a list of what you need to be able to work on RPMsg:

[edit] SYS/BIOS Tools

The SYS/BIOS-side source code is developed based on top of an underlying technology called Real Time Software Components (RTSC). RTSC is an open-source specification within the Eclipse.org ecosystem for providing reusable software components (called "packages") for use in embedded systems.

The SYS/BIOS RPMsg code, requires the following tools/products, in addition, to provide a proper development environment.

Most of the tools/products are also installed as part of Code Composer Studio (CCS), an eclipse-based IDE environment for creating, building and debugging projects. CCS is typically used for debugging purposes using a proper JTAG (XDS560v2 or a XDS100v2). Debugging using CCS and JTAGs are better explained in the Emulation wiki. The recommended version of CCS for debugging is CCSv5.1 and can be downloaded from the following download link.

In addition, there might be other Multimedia Framework Products like Codec Engine (CE), Framework Components (FC), XDAIS Algorithm Standard, OSAL, required for building an overall MM stack, but these are not essential for just SYS/BIOS RPMsg.

[edit] Repositories

The SYS/BIOS RPMsg code is maintained in the below tree. There is a only a single branch currently that supports different products, but new branches might be created or forked off from the current branch to support multiple kernel trees/branches or products.

[edit] Product/Integration/Feature Tree

[edit] Open Source Tree

Please look up the RPMsg Open Source page (coming soon) for details on the upstream friendly version.

[edit] Source Files

The following are the typical directories and files associated with RPMsg on the SYS/BIOS side. Some of the files/modules may not be present in all the trees. This list only highlights the files specific to OMAP.

[edit] Build Instructions

[edit] Tools Setup

[edit] Download

All the required tools, except for ARM Code Generation Tools, are available for download publicly.


[edit] Installation

[edit] Build

The README file in the sysbios-rpmsg tree gives the detailed instructions for the build. The below gives out additional information not mentioned in the README.

bash$ export TMS470CGTOOLPATH=/data/bios-tools/cgtarm-4.9.0
bash$ export C6000CGTOOLPATH=/data/bios-tools/cgt6x-7.2.0
bash$ export BIOSTOOLSROOT=/data/bios-tools
bash$ export XDCVERSION=xdctools_3_22_01_21
bash$ make tools
REPO := /data/bios-tools
XDC  := /data/bios-tools/xdctools_3_22_01_21
BIOS := /data/bios-tools/bios_6_32_01_38 
IPC  := /data/bios-tools/ipc_1_23_01_26
bash$ make
<sysbios-rpmsg root>/src/ti/examples/srvmgr/ti_platform_omap4430_core0/debug/test_omx_sysm3.xem3
<sysbios-rpmsg root>/src/ti/examples/srvmgr/ti_platform_omap4430_core1/debug/test_omx_appm3.xem3

[edit] SYS/BIOS RPMsg Customizations

[edit] Building custom ducati-m3.bin

The RPMsg kernel driver expects to find the firmware binary by the exact file name, ducati-m3.bin. This file is loaded into the M3 processor cores. A basic ducati-m3.bin is generated by default when SYS/BIOS RPMsg is built.

To produce your own firmware binary, use the genrprc utility found in the <sysbios-rpmsg root>/src/utils directory. It is a script file typically invoked from within the src/utils directory.

bash$ ./genrprc <path to sysm3 image> <path to appm3 image> my-custom-ducati-m3.bin
bash$ <sysbios-rpmsg root>/src/utils/genrprc <path to sysm3 image> <path to appm3 image> my-custom-ducati-m3.bin

A firmware binary is generated from the individual ELF executables of the remote cores, e.g. the .xem3 files. The genrprc utility adds version information by walking down the directory paths from where the executable are located. As such, it is strongly recommended to not relocate the exectables prior to running genrprc.

For proper execution of the custom binary, it always needs to be copied as ducati-m3.bin to the required file system path, typically /lib/firmware for generic Linux.

See also the readrprc utility for getting information back from a ducati firmware binary.

[edit] System Trace Buffer

A trace buffer exists in shared memory to make system traces available to the HLOS. A SYS/BIOS application will fill the buffer through the System_printf() function. The buffer is provided by ti.trace.SysMin module which supports a configurable size, however the size must be coordinated with the Platform configuration. The buffer size can be changed from <sysbios-rpmsg root>/src/ti/config/IpcCommon.cfg.xs.

 *  The SysMin used here vs StdMin, as trace buffer address is required for
 *  Linux trace debug driver, plus provides better performance.
var System      = xdc.useModule('xdc.runtime.System');
var SysMin      = xdc.useModule('ti.trace.SysMin');
System.SupportProxy = SysMin;
SysMin.bufSize  = 0x8000;

[edit] Module Logs

Several modules have configurable logs in RPMsg. Logs from these modules can be enabled in <sysbios-rpmsg root>/src/ti/config/IpcCommon.cfg.xs.

For messaging, change the occurrences of Diags.RUNTIME_OFF to Diags.RUNTIME_ON. The modules affected by these settings are ti.grcm.RcmServer, ti.grcm.RcmClient and ti.ipc.rpmsg.MessageQCopy.

/* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
var Text = xdc.useModule('xdc.runtime.Text');
Text.isLoaded = true;
var Registry = xdc.useModule('xdc.runtime.Registry');
Registry.common$.diags_ENTRY = Diags.RUNTIME_ON;
Registry.common$.diags_EXIT  = Diags.RUNTIME_ON;
Registry.common$.diags_INFO  = Diags.RUNTIME_ON;
Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_ON;
Registry.common$.diags_STATUS = Diags.RUNTIME_ON;
Diags.setMaskEnabled = true;

For Hibernation logs, add a line to enable INFO level logging for the Main module.

var Main = xdc.useModule('xdc.runtime.Main');
Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
Main.common$.diags_INFO = Diags.RUNTIME_ON;

Refer to xdc.runtime.Diags documentation for more information about diagnostic categories.

[edit] WFI Idle & Hibernation

The ti.pm module enables hibernation and WFI idle on the M3/M4 cores. It may be desirable to disable these features from the firmware. To disable WFI and hibernation, remove the IpcPower_idle() callback from the Idle Task functions list. This configuration is found in <sysbios-rpmsg root>/src/ti/config/IpcCommon.cfg.xs.

//Idle.addFunc('&IpcPower_idle');        /* IpcPower_idle must be at the end */

Without WFI, the Idle task will essentially perform a "busy wait", and running the list of Idle functions in a loop.

Hibernation of the M3/M4 cores is controlled from the Linux kernel and depends on the cores using WFI. Disabling WFI will have a similar effect to disabling hibernation form the kernel via the "Autosuspend support for remoteproc" config option. However, disabling autosuspend in Linux will not prevent WFI idle.

[edit] System Clock

[edit] Source Timer

The SYS/BIOS system clock can be configured to use different underlying timers. The timer can be switched between the NVIC SysTick timer of each individual M3/M4 core or a GP timer. Do note that the below is provided for reference only and is NOT recommended on OMAP-based products. The Power Management and Watchdog features cannot be possible using the internal timers.

To use the SysTick timer, the following GP Timer configuration needs to be removed. In <sysbios-rpmsg root>/src/ti/config/IpcCommon.cfg.xs remove the TimerProxy override.

/* Override the internal sysTick timer with dmTimer for Bios Timer */
//var halTimer = xdc.useModule('ti.sysbios.hal.Timer');
//halTimer.TimerProxy = dmTimer;

In <sysbios-rpmsg root>/src/ti/config/ducatiCore0.cfg and <sysbios-rpmsg root>/src/ti/config/ducatiCore1.cfg remove the Clock and Timer configuration.

/* ----------------------------- TICK ---------------------------------------*/
//var Clock = xdc.useModule('ti.sysbios.knl.Clock');
//Clock.tickSource = Clock.TickSource_USER;
/* Configure GPTimer3 as BIOS clock source */
//Clock.timerId = 0;

//var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer'); //var timerParams = new Timer.Params(); //timerParams.period = Clock.tickPeriod; //timerParams.periodType = Timer.PeriodType_MICROSECS; /* Smart-idle wake-up-capable mode */ //timerParams.tiocpCfg.idlemode = 0x3; /* Wake-up generation for Overflow */ //timerParams.twer.ovf_wup_ena = 0x1; //Timer.create(Clock.timerId, Clock.doTick, timerParams);

Also disable "OMAP remoteproc watchdog timer" in the Linux kernel configuration.

[edit] Tick Period

The period of the BIOS system clock defaults to 1000μs. This can be changed to another value. In <sysbios-rpmsg root>/src/ti/config/ducatiCore0.cfg and <sysbios-rpmsg root>/src/ti/config/ducatiCore1.cfg change the value of timerParams.period.

var timerParams = new Timer.Params();
timerParams.period = 2000;
timerParams.periodType = Timer.PeriodType_MICROSECS;

Be aware that changing the system clock period may have unintended consequences on other functionality. Timeout functions in application code is usually mentioned in terms of ticks, so it may caused unwanted additional delays if your application doesn't take into affect the Clock tickPeriod.

Personal tools