
Design Overview
XAPP1078 (v1.0) February 14, 2013 www.xilinx.com 5
CPU0 (running Linux) starts CPU1 (running bare-metal) by writing the value of 0x30000000 to
address 0xFFFFFFF0 using the included rwmem application. Normally, CPU0 would need to
run a set event (SEV) command to wake up CPU1. Because Linux, running on CPU0, is
constantly servicing interrupts (another source of events), an SEV command is not necessary.
When CPU1 wakes up, it reads the value 0x30000000 from address 0xFFFFFFF0 (written
using the rwmem command) and then jumps to address 0x30000000. Note that the FSBL
placed CPU1’s ELF at 0x30000000.
The softUart application, which is also included in the design files, is run as a background task
in Linux. When running, softUart continuously monitors shared OCM memory at locations
0xFFFF9000 (COMM_TX_FLAG_OFFSET) and 0xFFFF9004 (COMM_TX_DATA_OFFSET).
Whenever a 1 is present at COMM_TX_FLAG_OFFSET, softUart reads the value found at
COMM_TX_DATA_OFFSET and temporarily stores the value in a string array. When a value of
0x0A (\n) is received, the string array is displayed on STDOUT. Every time softUart reads a
value from COMM_TX_DATA_OFFSET, it clears the COMM_TX_FLAG_OFFSET content. This
clear signals to CPU1 that another character can be sent towards the softUart application
running on Linux.
Bare-Metal Application Code
The reference design has CPU1 running bare-metal application code. Linux, running on CPU0,
is responsible for initializing shared resources and starting up CPU1.
The bare-metal board support package (BSP) named standalone_v3_07_a that is part of the
EDK 14.3 install includes support for the preprocessor define constant USE_AMP. This
constant prevents the BSP from re-initializing the PS SCU that has previously been initialized
by CPU0. One caveat of using the USE_AMP constant is that the MMU mapping is adjusted to
create an alias of memory where the physical memory located at address 0x20000000 is
virtually mapped to 0x00000000. This remapping is done in the BSP file boot.s. The
re-mapping is not necessary for this design. A modified version of the BSP is included in the
reference design to remove the re-mapping when USE_AMP is set.
Within this AMP reference design, no Zynq UARTs are used by the bare-metal application.
Instead, the application running on CPU1 contains its own outbyte() function that is used to
communicate via OCM to a software UART running in a Linux application on CPU0. By adding
the outbyte() function, all stdout functionality of the standalone BSP is intact, allowing functions
such as xil_printf() to be used.
To prevent shared resource conflicts, the bare-metal application running on CPU1 must be
careful not to access resources such as the SCU. Linux disables cache access to the OCM.
However, the default standalone BSP would attempt to enable cache for OCM and therefore
conflict with Linux. When used in an AMP configuration, the function XIL_SetTlbAttributes() is
used in the CPU1’s main() application function to disable cache on OCM. The
XIL_SetTlbAttributes() function has been modified in the included source code such that it only
flushes L1 cache and leaves L2 cache untouched to prevent access to the SCU where L2
cache is controlled.
If the bare-metal code running on CPU1 requires control of L2 cache, a communications
channel must be created allowing the bare-metal code to request Linux to make the necessary
changes to the SCU. This action is beyond the scope or requirement for this example design so
care has been taken to prevent SCU access directly from the bare-metal code.
CPU1 Application
CPU1’s application is located in memory starting at address 0x30000000. The linker script is
used to set the starting address.
CPU1’s application does the following:
1. Configures the MMU to disable cache for OCM accesses in the address range of
0xFFFF0000 to 0xFFFFFFFF. The address mapping of the OCM is untouched so OCM
exists at addresses 0x00000000–0x0002FFFF and addresses
本页已使用福昕阅读器进行编辑。
福昕软件(C)2005-2008,版权所有,
仅供试用。