world leader in high performance signal processing
Trace: » test_mcapi

system configuration

MCAPI lib is on top of the ICC driver. Please refer to build kernel with ICC support for detail kernel configuration for ICC.

Check following setting before build kernel:

  1. L2 cache is disabled.
  2. External memory dcache policy set to write through.
  3. Reserve last 4M external memory for slave core applications.
  4. Reserve first 128k bytes L2 SRAM for ICC message queues and slave core code.

Configure libmcapi in buildroot:

Package Selection for the target  --->
    Libraries  --->
        Other  --->
        [*] libmcapi
    Miscellaneous  --->
    [*] bfin inter-core communication support
    ICC cpu type (BF609)  --->

Configure libmcapi in uClinux:

Library Configuration  --->
[*] Build libmcapi
Blackfin app programs  --->
[*] BF561 ICC utils

build MCAPI for linux on master core

Go to MCAPI library folder:

For buildroot

 make libmcapi

For uClinux

 make lib/libmcapi_only

build MCAPI for bare metal on slave core

MCAPI sample task

On coreb side, mcapi test task is on top of icc layer, and statically link with coreb side libmcapi.a. Mcapi test task will also be loaded by icc_loader on coreb, and will excute from entry point icc_task_init as icc task. To write a mcapi test task, you must include mcapi head files and call mcapi api to communicate with some endpoint on linux side.

A sample mcapi test task:

#include <mcapi.h>
#include <mcapi_datatypes.h>
#include <mcapi_test.h>
void icc_task_init(int argc, char *argv[]) {
  mcapi_status_t status;
  mcapi_version_t version;
  mcapi_endpoint_t ep1,ep2;
  int i;
  mcapi_uint_t avail;
  /* create a node */
  if (status != MCAPI_SUCCESS) { WRONG }

  /* create endpoints */
  ep1 = mcapi_create_endpoint (SLAVE_PORT_NUM1,&status);
  if (status != MCAPI_SUCCESS) { WRONG }

while(1) {
if (icc_wait())
  if (status != exp_status) { WRONG}
  coreb_msg("   Test PASSED\n");

build MCAPI lib and test suites

to build coreb icc utils, libmcapi_coreb and mcapi test task, just:

For buildroot

cd blackfin-linux-dist
make packages/icc_utils_only

For uClinux

cd blackfin-linux-dist
make user/blkfin-apps/icc_utils_only

you can find libmcapi_coreb under icc_utils folder

ls icc_utils/
example  icc_core  icc_loader  include  libmcapi_coreb

there are some simple test task for mcapi msg, pktchan and sclchan transfer modes.

ls icc_utils/example/task/mcapi*
mcapi_msg1  mcapi_msg1.c  mcapi_msg1.o  mcapi_pkt1  mcapi_pkt1.c  mcapi_pkt1.o  mcapi_scl1  mcapi_scl1.c  mcapi_scl1.o

run and test mcapi in Linux

After Linux boots up, loader icc bare metal stub to coreb.

root:/> icc_loader -l bin/icc

loader mcapi test task on coreb

root:/> icc_loader -e bin/mcapi_msg1

begin mcapi test, run mcapi test app on linux side, create a mcapi endpoint and communicate with coreb side loaded mcapi test task

root:/> msg1

JPEG encoding demo via MCAPI

More complicated MCAPI demo to encode a BMP image into JPEG image can be found at mcapi_bmp2jpg_demo.

test Linux and CCES mcapi interoperability on BF609

build CCES mcapi msg test project

  • import BF609_MCAPI_msg_CORE1 example project
example mcapi project path:
C:\Analog Devices\CrossCore Embedded Studio 1.0.0\Blackfin\Examples\services\mcapi\BF609_MCAPI_msg\BF609_MCAPI_msg_Core1
  • configure and build

customize app_cplbtab.c for core1 application to use sdram, select “Permit alteration of CPLB table entries” in the Startup Code/LDF tab

add sdram cplb entries to startup_ldr/app_cplbtab.c

     /* SDRAM Memory */

build project Project → build project

After building successfully we get the file BF609_MCAPI_msg_CORE1.dxe, we can load it onto core B to run in two ways, either by the bootrom code or by the Linux, details below.

load CCES mcapi test application by bootrom

Blackfin bootrom allows to load 1 LDR image into memory and run on both cores after reset. You can pack core1 MCAPI dxe binary and core 0 uboot elf binary into one LDR image by bfin-elf-ldr utility and run MCAPI application on core1 at the very begining of uboot init.

  • Build the latest bfin-elf-ldr on 2012R1 toolchain branch head. ldr utility in the 2012R1 release doesn't support pack multi binaries for dual core into one LDR image.
  • Build u-boot on 2012R1 branch head with CONFIG_CORE1_RUN option defined in config file. 2012R1 uboot release doesn't include this capability.
~$ cd u-boot

~/u-boot$ vi include/configs/bf609-ezkit.h
#define CONFIG_CORE1_RUN 1

~/u-boot$ make bf609-ezkit
  • Pack the dxe file of CCES core1 MCAPI test application and uboot ELF file into one LDR image.
~/u-boot$ cp /analogdevices/cces/BF609_MCAPI_msg_CORE1 .

~/u-boot$ bfin-elf-ldr -T bf609-0.0 -c DualCoreTest_uboot.ldr u-boot 
BF609_MCAPI_msg_CORE1.dxe --bmode PARA --use-vmas --initcode 
arch/blackfin/cpu/initcode.o  -J --punchit $((0x8000)):$((0x8000)):env-ldr.o
  • Flash this LDR image into Norflash
  • Switch the bootmode rotary to norflash mode and reset.

load CCES mcapi test application in Linux

Linux ICC utility icc_loader also support to load CCES executable binary. User can load CCES MCAPI application to coreb multiple times under Linux.

Just load by:

icc_loader -l BF609_MCAPI_msg_CORE1.dxe

load CCES mcapi msg test application

run cces_msg1 in libmcapi test, test interoperability with core1 mcapi msg application


Complete Table of Contents/Topics