AR# 45132

13.3 EDK - LibGen swaps XPAR_CPU_IDs in dual MicroBlaze system

Description

In a two MicroBlaze design, a mailbox (LogiCORE IP Mailbox) is used to communicate between microblaze_0 and microblaze_1.

The mailbox driver (mbox_v3_01_a) uses parameter "XPAR_CPU_ID" (found in xparameters.h) to know the identity of the processor. It appears that this parameter is always backwards.For example, when generating a BSP for microblaze_1, the parameter XPAR_CPU_ID gets the value 0. The BSP for microblaze_0 has a value 1 assigned to XPAR_CPU_ID.

How can I work around this, and are there other things to consider with this swap?

Solution

In all of the examples found in the $XILINX_EDK\sw\XilinxProcessorIPLib\driver\mbox_vx_xx_x\examples, you see that we translate what Libgen crates as the XPAR_CPU_ID, into a local CPU_ID, similar to below:

#if XPAR_CPU_ID == 0 #define MY_CPU_ID 1 #else #define MY_CPU_ID XPAR_CPU_ID #endif 

This should be the only change necessary, and no other parameters should need any change.

AR# 45132
Date 12/15/2012
Status Active
Type General Article
Tools More Less
IP