This tutorial will explain how to compile a Linux distro and the pingpong MQX application to test the communication between ARM Cortex-A9 and ARM Cortex-M4 cores on the SABRE Board for Smart Devices Based on the i.MX 6SoloX.
INITIAL SETUP
All of the steps were executed on an Ubuntu 14.04 64 bits machine, but should work on other distributions with minimal or no changes.
The first step is to install the required tools and applications in the host:
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo \
gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm picocom
You also need to install the repo tool that will be used to download the Freescale's BSP:
$ mkdir ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=${PATH}:~/bin
Create an environment variable to store the directory name that will be used to download and compile all required software and applications (do no forget to redefine this variable if you close the current terminal or open a new one).
$ export IMX6SOLOX=~/imx6solox
$ mkdir -p $IMX6SOLOX
LINUX DISTRIBUTION
Download the Freescale's BSP source code:
$ cd $IMX6SOLOX
$ mkdir -p fsl-release-bsp && cd fsl-release-bsp
$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.10.53-1.1.0_ga
$ repo sync
And compile a minimal image for the SABRE Board:
$ MACHINE=imx6sxsabresd source fsl-setup-release.sh -b build
$ bitbake core-image-minimal
After the compilation, a sdcard image should be available. Write it to the sdcard (do not forget to change the device name /dev/sdX in the command below).
$ cd tmp/deploy/images/imx6sxsabresd/
$ sudo dd if=core-image-minimal-imx6sxsabresd.sdcard of=/dev/sdX bs=1M && sync
To test the image you need to connect the board to your host machine using the USB cable. Two TTY ports will be created. Open your favorite terminal application (minicom, putty, screen, picocom) in the first one and check the Linux boot process. You should be able to login with the root user.
FIRMWARE MQX
Download the last MQX source code from Freescale's website at http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MQX#. I have used the 4.1.0 version in the tests. Do not forget to download the Linux version (*.gz).
Create a directory and decompress the source code:
$ cd $IMX6SOLOX
$ mkdir -p mqx && cd mqx
$ tar xfv ~/Downloads/Freescale\ MQX\ RTOS\ 4.1.0\ for\ i.MX\ 6SoloX\ Linux\ Base.gz
$ ls
build config doc mcc mqx tools
Download and install the required toolchain to compile the MQX application:
$ cd $IMX6SOLOX
$ mkdir -p toolchain && cd toolchain
$ wget https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/gcc-arm-none-eabi-4_8-2014q1...
$ tar xfv gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2 && rm gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2
Now compile the MQX and related libraries:
$ cd $IMX6SOLOX/mqx/build/imx6sx_sdb_m4/make
$ export TOOLCHAIN_ROOTDIR=$IMX6SOLOX/toolchain/gcc-arm-none-eabi-4_8-2014q1
$ ./build_gcc_arm.sh
And compile the pingpong application:
$ cd $IMX6SOLOX/mqx/mcc/examples/pingpong/build/make/pingpong_example_imx6sx_sdb_m4
$ ./build_gcc_arm.sh
Convert the ELF application to a binary format:
$ arm-none-eabi-objcopy -O binary gcc_arm/extflash_release/pingpong_example_imx6sx_sdb_m4.elf m4_qspi.bin
The U-Boot bootloader will be responsible to read the MQX firmware from the SDCARD, write in the NOR flash and start the application on the Cortex-M4.
Save the m4_qspi.bin file in the first sdcard partition and access the U-Boot's prompt.
Run the following command to write the firmware image to the NOR flash:
> run update_m4_from_sd
And setup U-Boot environment variables so the application will start automatically at boot:
> setenv fdt_file imx6sx-sdb-m4.dtb
> setenv mmcargs "${mmcargs} uart_from_osc"
> setenv bootcmd "run m4boot;${bootcmd}"
> saveenv
Open another terminal application on the second TTY to have access to the MQX console e reboot the board. You should see the message below:
***** MCC PINGPONG EXAMPLE *****
Please wait :
1) A9 peer is ready
Then press "S" to start the demo
********************************
Press "S" to start the demo :
Wait for the Linux boot process to finish and press "S" to start the demo application.
In the Linux terminal, start the communication with the pingpong application:
# echo 1 > /sys/devices/soc0/soc.1/2200000.aips-bus/mcctest.17/pingpong_en &
You should see the log of messages sent and received on both terminals.
Please let me know if you have any question.
Best regards,
Sergio Prado
sergio.prado@e-labworks.com
http://e-labworks.com