Over the last two blogs I have provided a simple overview of the Parallella board and the software development environment. The next logical step is to create a simple application which is run on each core of the epiphany device in turn and performs a simple hello world type application.
Achieving this will ensure we understand how to:
- Use of the epiphany hardware abstraction layer to initialize, reset, open and load the target Epiphany device
- Use of basic commands within the epiphany hardware utility library
- Develop a build script to create the host & target ELF executables
- Develop a run script to execute the application on the host and target.
Assuming you have the eSDK correctly installed the first step it to create two directories within your chosen development directory mine I created under “/home/linaro/adams_parallella/chronicles_3” these directories should are called Debug and Src. Within the Src directory we will store the application source code for the host and target (epiphany). The Debug folder is where the build process will store the resultant ELF.
The application will use the shared DRAM memory to communicate between the host and target application. At a predefined memory location known to both applications the target application will write a string using the sprint function while the host application will look for, retrieve and print out that message.
The main file for this demonstration is going to be the host application this application will
- Initialize the system – using the e_init() function
- Reset the system – using the e_reset_system() function
- Obtain the platform information – using the e_get_platform_info() this defines the core configuration, number of devices within the system and number of external memories.
- Allocate the location of the shared memory used for communication
- Address each core in turn and retrieve its printed string. To do this the host must:
- Define a single core work group using e_open()
- Reset the workgroup using e_reset_group()
- Load the s record into the working group using e_load(), when doing this it will also check for the success of the operation
- Wait for the target to finish execute its application
- Read the shared memory location using e_read() to obtain the message from the target
- Output the message
- Having finally completed addressing each core the host application will then close and tidy up the epiphany and allocated memory before exiting
By comparison the epiphany target application is much simpler, it just gets the core ID for the core it is currently running upon, formats this into a string and writes it into the shared memory location.
I have created a git hub repository which contains all of the code and scripts used to create the above example.