Page 2
Embedded Artists AB. Disclaimer Embedded Artists AB makes no representation or warranties with respect to the contents hereof and specifically disclaim any implied warranties or merchantability or fitness for any particular purpose. Information in this publication is subject to change without notice and does not represent a commitment on the part of Embedded Artists AB.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 3 Table of Contents 1 Document Revision History ......... 5 2 Introduction ............6 Multi-Core..................6 Additional Documentation ............. 6 Conventions ..................6 3 Hardware Related ..........7 Prerequisites ................... 7 UART Interfaces on COM Carrier board version 1 ......
Page 4
Working with Cortex-M4 on iMX6 SoloX COM Board Page 4 6.6.2 Create project: New ..............27 6.6.3 Create project: Linked folders ............28 6.6.4 Create project: Exclude from build ..........30 Create project: “Include” paths ............ 31 6.6.5 6.6.6 Create project: Settings ............... 32 6.6.7...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 5 1 Document Revision History Revision Date Description 2015-11-11 First release 2016-01-20 - Added description about how to build FreeRTOS: Chapter Error! Reference source not found. and Chapter 6 - Updated Chapter 4 to describe how to load an application to TCM, OCRAM, and DDR memory.
Page 6 2 Introduction This document provides you with step-by-step instructions for how to work with the Cortex-M4 microcontroller on the iMX6 SoloX COM Board (EAC00244). The iMX6 SoloX Developer’s Kit (EAK00245) has been used when writing these instructions. Multi-Core The i.MX6 SoloX processor has two cores;...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 7 3 Hardware Related Prerequisites To be able to follow all the instructions in this document the following is required. • One iMX6 SoloX Developer’s Kit (EAK00331, EAK00245) • If using the Developer’s Kit version 1 (V1) you need two FTDI cables for console output/input from both the Cortex-A9 and the Cortex-M4.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 8 3.2.1 Applications for Freescale Sabre Board If you are testing pre-compiled applications developed for the Freescale Sabre board then console output will be available on different pins, that is, not on J15 connector. UART2 is used, but on pins that are available on the XBee connector (J17), see Figure 2.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 9 J18, J17, J19, J20 Left to right J19, J20 Upper position: connect UART-A to Cortex-A console Lower position: connect UART-C to Cortex-A console J18, J17 Upper position: connect UART-B to Cortex-M console...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 10 4 Download and Start an Application This section describes how to download and start a pre-compiled application. Update boot partition with needed files The remaining parts of this chapter assumes that the first partition of the eMMC contains the pre- compile applications.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 11 # mkdir /mnt/mmcboot # mount /dev/mmcblk2p1 /mnt/mmcboot 4. Copy the bin file(s) from the USB memory stick to the boot partition. In this example we are only copying m4_hello_tcm.bin # cp /mnt/usb/m4_hello_tcm.bin /mnt/mmcboot/ 5.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 12 2. Set the M4 file name in the variable. m4image => setenv m4image m4_hello_tcm.bin 3. Set the address where the application will run from (TCM memory in this case). => setenv m4runaddr 0x7f8000 4.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 13 Run from DDR RAM Make sure you have built an application for DDR RAM or selected a pre-built application for DDR RAM (name ends with _ddr). The application file must have been copied to eMMC as described in section 4.1 above.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 14 5 Remote communication applications (RPMsg) Ping-pong application The RPMsg ping-pong application is an example of communication between the Cortex-A9 core and the Cortex-M4 core using the RPMsg API. 1. Make sure the file is available on eMMC as described in m4_rpmsg_ping_qspi.bin...
The board support package (BSP) that is available in the FreeRTOS package is for the Freescale/NXP i.MX6 SoloX Sabre board. Embedded Artists has at the time of writing this document not developed a BSP for the i.MX6 SoloX COM board / Developer’s Kit. This means that changes (most often only pin muxing) might be necessary before building and running any of the examples.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 16 Build with ARM DS-5 This section describes how to setup ARM DS-5 to build the sample applications. The instructions are originally from the document found at the location below ( is the path to where the <FreeRTOS>...
Page 17
Working with Cortex-M4 on iMX6 SoloX COM Board Page 17 Figure 5 - Import Existing Projects b. Browse to the DS-5 project files for the application to import. In this example it is the OCRAM version of “hello world” found at: <FreeRTOS>\examples\imx6sx_sdb_m4\demo_apps\hello_world\...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 18 6.3.1 BSP files Section 6.2 described changes that must be made to BSP files. When a project has been imported to DS-5 it is possible to edit these files in DS-5 instead of an external editor. The files are found in the “board”...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 19 Figure 9 – ULINK Pro and debug interface board 6.4.2 Import TCM version of “hello world” In this example we are going to debug the same application as was built in section 6.3 which is the TCM version of Hello World.
Page 20
Working with Cortex-M4 on iMX6 SoloX COM Board Page 20 Figure 11 - Setup Debug Connection 4. In the “Connection” tab go to NXP → i.MX6 SoloX Sabre SDB → Bare Metal debug and choose “Debug Cortex-M4” as shown in Figure 11.
Page 21
Working with Cortex-M4 on iMX6 SoloX COM Board Page 21 Figure 13 - Debug from entry point 8. Go to the “OS Awareness” tab and choose FreeRTOS in the list as shown in Figure 14. Figure 14 - OS Awareness 9.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 22 Figure 15 - Active debug session NOTE 1: If you are not able to start the debug session please make sure that you have only booted into u-boot on the Cortex-A9 and not into Linux when you start the debug session.
Page 23
Working with Cortex-M4 on iMX6 SoloX COM Board Page 23 Figure 16 - MinGW Installation 3. When the installation manager window appears, as shown in Figure 17, choose mingw32- in the “Basic Setup” section. base msys-base Figure 17 - MinGW Installation Manager 4.
Page 24
Working with Cortex-M4 on iMX6 SoloX COM Board Page 24 Figure 18 - System Properties in Windows Figure 19 - Environment Variables in Windows 6. Create the environment variable ARMGCC_DIR a. Click the “New” button below “System variables” as seen in Figure 19.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 25 b. Add as variable name and specify the path to ARM GCC as value. ARMGCC_DIR The default installation path of ARM GCC which has been installed when following these instructions is: C:\Program Files (x86)\GNU Tools ARM Embedded\4.8 2014q1...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 26 Figure 21 - CMake Install Options 6.5.4 Build Application 1. Open a GCC Command prompt. When ARM GCC was installed a shortcut was created in the start menu as shown in Figure 22.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 27 NOTE: You must have followed the instructions in section 6.5 before continuing with the instructions in this section. It is assumed that you have installed Eclipse with the CDT (C/C++ Development Tooling) plugin.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 28 Figure 25 - GNU ARM Toolchain 6.6.3 Create project: Linked folders Section 6.1.1 shows the file structure of the installed FreeRTOS bundle for iMX6. The source code that we need to build is located in several different folders and we need to add these to the Eclipse project.
Page 29
Working with Cortex-M4 on iMX6 SoloX COM Board Page 29 Figure 27 - Linked folder Repeat the above steps for the following folders: • <FreeRTOS path>/examples/imx6sx_sdb_m4 o This folder contains board specific code • <FreeRTOS path>/platform o Contains initialization and driver code for the iMX7 processor •...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 30 6.6.4 Create project: Exclude from build Some of the sub-folders added to project as described in section 6.6.3 shouldn’t be part of the build. These can be excluded by right-clicking on the folder and then selecting “Resource Configurations” →...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 31 • FreeRTOS/Source/portable/IAR o This folder contains code specific for the IAR compiler • FreeRTOS/Source/portable/RVDS o This folder contains code specific for the RVDS compiler • FreeRTOS/Source/portable/MemMang/heap_2.c (also heap_3.c and heap_4.c) o The MemMang folder contains several implementations of memory allocation routines.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 32 Figure 32 - Workspace folder Add the following folders as include paths: • FreeRTOS/Source/include • FreeRTOS/Source/portable/GCC/ARM_CM4F • hello_world • imx6sx_sdb_m4 • platform/CMSIS/Include • platform/devices • platform/devices/MCIMX6X/include • platform/devices/MCIMX6X/startup • platform/devices/drivers/inc •...
Page 33
Working with Cortex-M4 on iMX6 SoloX COM Board Page 33 Figure 33 - Build command Go to the “Tool Settings” tab and click on “Target Processor”. Change the values of the following fields. This is also shown in Figure 34.
Page 34
Working with Cortex-M4 on iMX6 SoloX COM Board Page 34 • __FPU_PRESENT • ARM_MATH_CM4 Figure 35 - Preprocessor symbols Still in the “Tool Settings” tab go to “Cross ARM GNU C Linker” → General. Add the workspace path to the linker file that is going to be used. Since we are building an application for OCRAM we select platform/devices/MCIMX7D/linker/gcc/MCIMX6X_M4_ocram.ld...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 36 6.6.7 Build application Now it is time to build the application. This can, for example, be done by clicking on the “Build” icon in the toolbar as shown in Figure 39. It can also be done by right-clicking on the project and then click on “Build Project”.
Page 37
Working with Cortex-M4 on iMX6 SoloX COM Board Page 37 Figure 40 - LPC-Link 2 connected to Debug interface board Connect the FPC cable for the Debug interface board to the connector on the COM Board as shown in Figure 41.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 38 Also make sure that the LPC-Link 2 board is connected to your PC via a USB cable. 6.7.5 Create a debug configuration In Eclipse go to Run → Debug Configurations and then select “GDB SEGGER J-Link Debugging”.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 39 Figure 43 - Debugger tab Go to the “Startup” tab and then “Runtime Options”. Select “RAM application” as shown in Figure 44. Figure 44 - Startup tab 6.7.6 Start a debug session There are several ways to start a debug session.
Page 40
Working with Cortex-M4 on iMX6 SoloX COM Board Page 40 Figure 45 - Start Debug session When starting the debug session the J -Link terms and conditions must be accepted by clicking the “Accept” button. Figure 46 - J-Link Terms and conditions Since we haven’t specified a correct device we have to select which target to debug.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 42 7 Use DS-MDK for Application Development DS-MDK is a commercial Eclipse based IDE and debugger from ARM/Keil. The development environment comes with support for NXP’s application processors and especially those supporting Heterogeneous Multi-Processing such as the i.MX6 SoloX.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 43 Figure 49 - RPMSG TTY Example The application will now be added to your workspace. Go back to the Pack Manager and click on the Copy button for the Linux Application TTY. Now you have both the application that will run on the A9 core and the application that will run on the M4 core in your workspace.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 44 7.4.3 Create a debug configuration Go to Run → Debug configurations in the menu. There should be a debug configuration called MCIMX6SX_RPMSG_TTY_RTX_M4 under the CMSIS DS-5 Debugger as shown in Figure 51.
Page 46
Working with Cortex-M4 on iMX6 SoloX COM Board Page 46 Figure 54 - OS Awareness When the debug configuration is ready click on the Debug button and a debug session will be established as shown in Figure 55. NOTE: Make sure that you have only booted into u-boot on the Cortex-A9 and not into Linux.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 47 Debug the Linux Application The Linux application will be debugged using over a network connection. This means gdbserver that there is no need to use the debug adapter (such as ULINKpro) when debugging the Linux application.
Page 48
Working with Cortex-M4 on iMX6 SoloX COM Board Page 48 Figure 57 - RSE Perspective Choose SSH Only as connection type as shown in Figure 58 and then click Next. Figure 58 - Remote System Type Enter the IP address in the Host name field as shown in Figure 59 and then click Finish to create the connection.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 49 Figure 59 - Host name / IP address It could now look like in Figure 60. If you click on Sftp Files → My Home you will see the home directory on the target.
Page 51
Working with Cortex-M4 on iMX6 SoloX COM Board Page 51 In the Debugger tab make sure Debug from symbol is chosen and the symbol is set to main as shown in Figure 63. Figure 63 - Debugger tab Click on the Debug button to start the debug session.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 52 Simultaneous Debugging Follow these steps to simultaneously debug RPMSG_TTY_RTX_M4 and Linux Application TTY. 1. Boot into u-boot 2. Change device tree file (dtb) file and also . The boot argument...
Working with Cortex-M4 on iMX6 SoloX COM Board Page 53 8 Troubleshooting JTAG connection problem when Linux has booted 8.1.1 Description of problem It is not possible to make a debug connection to the target via JTAG when Linux has booted. It is possible to establish a connection before Linux has booted, such as when the u-boot bootloader is active.
Working with Cortex-M4 on iMX6 SoloX COM Board Page 54 1. Open the configuration file for the SSH server # nano /etc/ssh/sshd_config 2. Find the line that starts with #PermitRootLogin and remove the ‘#’ (hash) character. If you cannot find this line just add it to the file (without the hash) 3.