In my previous article (see “Tutorial: First Steps with NXP i.MX7 and Toradex Colibri Board“) I have booted the i.MX7 on a Toradex CPU module. In this post I’m showing how to run a FreeRTOS application on that board.
Outline
The i.MX7 features one or two ARM Cortex-A7, plus a single ARM Cortex-M4. Have a read at this Toradex knowledge base article which describes the overall architecture.
FreeRTOS Git
Next step is to get a FreeRTOS port for the M4. Toradex has a port available on the following git repository:
git://git.toradex.com/freertos-toradex.git freertos-colibri-imx7/
Clone it with your git client.
git clone -b colibri-imx7-m4-freertos-v8 git://git.toradex.com/freertos-toradex.git freertos-colibri-imx7/
💡 Important: do not clone it into a path with spaces, as the make files are *not* space aware!
Or with a client like SourceTree:
💡 Important: make sure that you use the 1.0.1 branch, see https://www.toradex.com/community/questions/4072/helloworld-demo-doesnt-work-with-freertos-on-colib.html
Below an image how it looks like in SourceTree after cloning:
💡 As the Git tag indicates, this is an older FreeRTOS V8.0.0 release. I see later how to use the latest V9.0.0 version.
Building FreeRTOS Demo Applications
Inside the repository (freertos-toradex\examples\imx7_colibri_m4\demo_apps), there are several example projects, with subfolders for each IDE supported. To use the armgcc one, it requires cmake installed.
On Linux use the following to get it installed:
sudo apt-get install make cmake
For Windows cmake is available from https://cmake.org/download/. Additionally for Windows the mingw32 package from https://sourceforge.net/projects/mingw-w64/ is needed.
Because I don’t want to change the system paths of my Windows system, I’m using the following batch file which addes the paths and does the example project build:
@ECHO off ECHO Adding cmake and mingw32 path to PATH SET CMAKEBIN=C:\nxp\cmake\bin SET MINGW32BIN=C:\MinGW\bin ECHO %PATH%|findstr /i /c:"%CMAKEBIN:"=%">nul || set PATH=%PATH%;%CMAKEBIN% ECHO %PATH%|findstr /i /c:"%MINGW32BIN:"=%">nul || set PATH=%PATH%;%MINGW32BIN% ECHO %PATH% @rem set where to find the ARM launchpad compiler and tools SET ARMGCC_DIR=C:\nxp\KDS_3.2.0\Toolchain @rem build examples build_all.bat
Running the build will build the example project.
Below an example make output:
C:\temp\toradex\freertos-toradex\examples\imx7_colibri_m4\demo_apps\hello_world\armgcc>type build.bat @ECHO off ECHO Adding cmake and mingw32 path to PATH SET CMAKEBIN=C:\nxp\cmake\bin SET MINGW32BIN=C:\MinGW\bin ECHO %PATH%|findstr /i /c:"%KDSBIN:"=%">nul || set PATH=%PATH%;%CMAKEBIN% ECHO %PATH%|findstr /i /c:"%MINGW32BIN:"=%">nul || set PATH=%PATH%;%MINGW32BIN% ECHO %PATH% @rem set where to find the ARM launchpad compiler and tools SET ARMGCC_DIR=C:\nxp\KDS_3.2.0\Toolchain @rem build examples build_all.bat C:\temp\toradex\freertos-toradex\examples\imx7_colibri_m4\demo_apps\hello_world\armgcc>type build.bat @ECHO off ECHO Adding cmake and mingw32 path to PATH SET CMAKEBIN=C:\nxp\cmake\bin SET MINGW32BIN=C:\MinGW\bin ECHO %PATH%|findstr /i /c:"%CMAKEBIN:"=%">nul || set PATH=%PATH%;%CMAKEBIN% ECHO %PATH%|findstr /i /c:"%MINGW32BIN:"=%">nul || set PATH=%PATH%;%MINGW32BIN% ECHO %PATH% @rem set where to find the ARM launchpad compiler and tools SET ARMGCC_DIR=C:\nxp\KDS_3.2.0\Toolchain @rem build examples build_all.bat C:\temp\toradex\freertos-toradex\examples\imx7_colibri_m4\demo_apps\hello_world\armgcc>build.bat Adding cmake and mingw32 path to PATH C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Users\Erich Styger\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files\IVI Foundation\VISA\Win64\Bin\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Windows\twain_32\CNQL60;C:\CooCox\CoIDE_V2Beta\gcc\bin;C:\CooCox\CoIDE_V2Beta\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\MinGW\bin;C:\nxp\cmake\bin -- TOOLCHAIN_DIR: C:/nxp/KDS_3.2.0/Toolchain CMake Deprecation Warning at C:/nxp/cmake/share/cmake-3.7/Modules/CMakeForceCompiler.cmake:69 (message): The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): C:/temp/toradex/freertos-toradex/tools/cmake_toolchain_files/armgcc.cmake:38 (CMAKE_FORCE_C_COMPILER) C:/nxp/cmake/share/cmake-3.7/Modules/CMakeDetermineSystem.cmake:85 (include) CMakeLists.txt CMake Deprecation Warning at C:/nxp/cmake/share/cmake-3.7/Modules/CMakeForceCompiler.cmake:83 (message): The CMAKE_FORCE_CXX_COMPILER macro is deprecated. Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): C:/temp/toradex/freertos-toradex/tools/cmake_toolchain_files/armgcc.cmake:39 (CMAKE_FORCE_CXX_COMPILER) C:/nxp/cmake/share/cmake-3.7/Modules/CMakeDetermineSystem.cmake:85 (include) CMakeLists.txt -- BUILD_TYPE: Debug -- TOOLCHAIN_DIR: C:/nxp/KDS_3.2.0/Toolchain CMake Deprecation Warning at C:/nxp/cmake/share/cmake-3.7/Modules/CMakeForceCompiler.cmake:69 (message): The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): C:/temp/toradex/freertos-toradex/tools/cmake_toolchain_files/armgcc.cmake:38 (CMAKE_FORCE_C_COMPILER) CMakeFiles/3.7.0-rc2/CMakeSystem.cmake:6 (include) CMakeLists.txt CMake Deprecation Warning at C:/nxp/cmake/share/cmake-3.7/Modules/CMakeForceCompiler.cmake:83 (message): The CMAKE_FORCE_CXX_COMPILER macro is deprecated. Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): C:/temp/toradex/freertos-toradex/tools/cmake_toolchain_files/armgcc.cmake:39 (CMAKE_FORCE_CXX_COMPILER) CMakeFiles/3.7.0-rc2/CMakeSystem.cmake:6 (include) CMakeLists.txt -- BUILD_TYPE: Debug -- The ASM compiler identification is GNU -- Found assembler: C:/nxp/KDS_3.2.0/Toolchain/bin/arm-none-eabi-gcc.exe -- Configuring done -- Generating done -- Build files have been written to: C:/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/demo_apps/hello_world/armgcc Scanning dependencies of target hello_world [ 4%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c.obj[ 8%] Building ASM object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/devices/MCIMX7D/startup/gcc/startup_MCIMX7D_M4.S.obj [ 13%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/portable/MemMang/heap_2.c.obj [ 17%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/demo_apps/hello_world/main.c.obj [ 21%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/uart_imx.c.obj [ 26%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/croutine.c.obj [ 30%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/event_groups.c.obj [ 34%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/list.c.obj [ 39%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/queue.c.obj [ 43%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/tasks.c.obj [ 47%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/timers.c.obj [ 52%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/ccm_analog_imx7d.c.obj [ 56%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/ccm_imx7d.c.obj [ 60%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/rdc.c.obj [ 65%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/wdog_imx.c.obj [ 69%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/utilities/src/debug_console_imx.c.obj [ 73%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/utilities/src/print_scan.c.obj [ 78%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/devices/MCIMX7D/startup/system_MCIMX7D_M4.c.obj [ 82%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/pin_mux.c.obj [ 86%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/board.c.obj [ 91%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/clock_freq.c.obj [ 95%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/demo_apps/hello_world/hardware_init.c.obj [100%] Linking C executable debug\hello_world.elf [100%] Built target hello_world -- TOOLCHAIN_DIR: C:/nxp/KDS_3.2.0/Toolchain CMake Deprecation Warning at C:/nxp/cmake/share/cmake-3.7/Modules/CMakeForceCompiler.cmake:69 (message): The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): C:/temp/toradex/freertos-toradex/tools/cmake_toolchain_files/armgcc.cmake:38 (CMAKE_FORCE_C_COMPILER) CMakeFiles/3.7.0-rc2/CMakeSystem.cmake:6 (include) CMakeLists.txt CMake Deprecation Warning at C:/nxp/cmake/share/cmake-3.7/Modules/CMakeForceCompiler.cmake:83 (message): The CMAKE_FORCE_CXX_COMPILER macro is deprecated. Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): C:/temp/toradex/freertos-toradex/tools/cmake_toolchain_files/armgcc.cmake:39 (CMAKE_FORCE_CXX_COMPILER) CMakeFiles/3.7.0-rc2/CMakeSystem.cmake:6 (include) CMakeLists.txt -- BUILD_TYPE: Release -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_TOOLCHAIN_FILE -- Build files have been written to: C:/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/demo_apps/hello_world/armgcc [ 4%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c.obj [ 8%] Building ASM object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/devices/MCIMX7D/startup/gcc/startup_MCIMX7D_M4.S.obj [ 13%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/portable/MemMang/heap_2.c.obj [ 17%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/demo_apps/hello_world/main.c.obj [ 21%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/uart_imx.c.obj [ 26%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/croutine.c.obj [ 30%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/event_groups.c.obj [ 34%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/list.c.obj [ 39%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/queue.c.obj [ 43%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/tasks.c.obj [ 47%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/rtos/FreeRTOS/Source/timers.c.obj [ 52%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/ccm_analog_imx7d.c.obj [ 56%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/ccm_imx7d.c.obj [ 60%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/rdc.c.obj [ 65%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/drivers/src/wdog_imx.c.obj [ 69%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/utilities/src/debug_console_imx.c.obj [ 73%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/utilities/src/print_scan.c.obj [ 78%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/platform/devices/MCIMX7D/startup/system_MCIMX7D_M4.c.obj [ 82%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/pin_mux.c.obj [ 86%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/board.c.obj [ 91%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/clock_freq.c.obj [ 95%] Building C object CMakeFiles/hello_world.dir/C_/temp/toradex/freertos-toradex/examples/imx7_colibri_m4/demo_apps/hello_world/hardware_init.c.obj [100%] Linking C executable release\hello_world.elf [100%] Built target hello_world Press any key to continue . . . C:\temp\toradex\freertos-toradex\examples\imx7_colibri_m4\demo_apps\hello_world\armgcc>
The subfolders contain the build output files:
FreeRTOS Hello World Application
The FreeRTOS Hello World application is very simple: It starts a single task (HelloTask) which prints a “Hello World!”, and then it waits for input characters from the UART which then get printed back on the same UART:
#include "FreeRTOS.h" #include "task.h" #include "board.h" #include "debug_console_imx.h" /*! * @brief A basic user-defined task */ void HelloTask(void *pvParameters) { uint8_t receiveBuff; // Print the initial banner PRINTF("\r\nHello World!\n\n\r"); while(1) { // Main routine that simply echoes received characters forever // First, get character receiveBuff = GETCHAR(); // Now echo the received character PUTCHAR(receiveBuff); } } /*! * @brief Main function */ int main(void) { // Initialize demo application pins setting and clock setting. hardware_init(); // Create a demo task which will print Hello world and echo user's input. xTaskCreate(HelloTask, "Print Task", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL); // Start FreeRTOS scheduler. vTaskStartScheduler(); // Should never reach this point. while (true); }
The demo uses UART-B for the input/output. UART-A is used by u-boot and Linux for debug console messages (see (“Tutorial: First Steps with NXP i.MX7 and Toradex Colibri Board“), so I attach two terminals to the Iris Carrier board: UART-A for the debug messages and UART-B for the M4 FreeRTOS UART-B:
UART-B is available on the expansion header on pin 31 and 32:
I connect a terminal program to both UARTs with 115200 baud.
Putting FreeRTOS Application on SD Card
Copy the .bin file on a micro SD card (e.g. on a boot image created for i.MX7):
U-Boot
Then reboot the i.MX7 board with the SD card inserted. If it already has booted, login with ‘root’ and issue a ‘reboot’ command:
colibri-imx7 login: root reboot
During the boot sequence, there is a message
Normal Boot Hit any key to stop autoboot: 1
Hit a key in the terminal at that time, and it will abort the normal boot process.
With the ‘ls’ command check that the content of the SD card:
ls mmc 0:1
It should show the binary file we have stored on it among other files:
... 13272 hello_world.bin 15 file(s), 1 dir(s)
Use the fatload command to load the binary at address 0x7F8000
fatload mmc 0:1 0x7F8000 hello_world.bin
U-boot reports loading the file:
Colibri iMX7 # fatload mmc 0:1 0x7F8000 hello_world.bin fatload mmc 0:1 0x7F8000 hello_world.bin reading hello_world.bin 13272 bytes read in 27 ms (479.5 KiB/s)
Then flush the data cache:
dcache flush
Followed by the command to boot the auxiliary M4 core:
bootaux 0x7F8000
FreeRTOS Demo Application on M4
With the terminal connected to UART-B, I should see the ‘hello’ message. And the FreeRTOS task will echo whatever I submit on that UART from the terminal:
Success! I have a FreeRTOS application running on the M4 core of the i.MX7 :-).
Summary
I’m ending my current week-end project with first steps on the NXP i.MX7 and running a FreeRTOS application on the M4 core. The combination of a Linux running on one or two A7 plus having a Cortex-M4 for realtime aspects has huge potential to me. I have the module with Linux running, and I have a simple hello world application on the M4 working.
Running a simple FreeRTOS application on the M4 core of the i.MX7 requires several steps, but they should not be too difficult. The above steps currently require manual steps and are using the pre-installed Linux on the Colibri board. It is possible to automatically load and start the code for the M4, but for this it is better that I update the Linux on the Colibri module, as there can be issues with clocks and UARTs:
Note: In V2.6 Alpha 1, there is an issue rendering the Linux clock driver useless when the Cortex-M4 is started. Due to a second bug, this only manifests on Colibri iMX7D. Use the latest 3.14.52 kernel available in the -next branch to avoid those issues.
Some examples seem also to interfere with SPI, therefor the node ecspi3 might need to be disabled as well.
So in a future article I’m exploring how to update the Linux on the module. And as an ultimate goal I want to use JTAG debugging for the Cortex-M4 too.
Happy FreeRTOSing 🙂
Links
- Tutorial: First Steps with NXP i.MX7 and Toradex Colibri Board
- Tutorial: Updating Embedded Linux on Toradex i.MX7 Colibri Module using SD Card
- FreeRTOS: http://freertos.org/
- Toradex Colibri Modules for ARM: https://www.toradex.com/computer-on-modules/colibri-arm-family
- FreeRTOS on Colibri: http://developer.toradex.com/knowledge-base/freertos-on-the-cortex-m4-of-a-colibri-imx7
- Git of Toradex FreeRTOS for i.MX: http://git.toradex.com/cgit/freertos-toradex.git/
- CMake: https://cmake.org/download/
- Mingw32: https://sourceforge.net/projects/mingw-w64/
Interesting… for the M4F part, is it possible to write & debug code using KDS?
LikeLike
Writing: yes, I’m working on that, maybe I should publish an article about this?
Debug: I’m not there yet, but that’s what I want do for sure.
LikeLike
Great ! I was just thinking about to order Colibri. But there is also the Warp7
available on Farnell Element14. What do you think about Warp7 ?
LikeLike
I saw the news about Warp7, but unfortunately it is not available for me to order in Farnell or Element14. It seems to me it is only available in some regions. The Warp7 is interesting for sure, but it is a i.MX7Solo (I have a Dual A7 on that Toradex Module). I checked the Element14 UK site, and to me the price point of the Warp7 is higher than a Colibri+Carrier board. But the board size of the Warp7 would be smaller. So I have to wait until the Warp7 is available to me to try it out.
LikeLike
Hi,
Do you have a link for the Colibri+Carrier board? as it seems it would cost 110 euros + delivery for the Toradex setup whereas the Warp7 is 91 euros and free delivery
LikeLike
My bad, I did not count in shipping costs. Did not realize that the Warp7 shipping would be free.
Toradex Colibri Modules: https://www.toradex.com/products/nxp-freescale-imx-7
Iris Carrier: https://www.toradex.com/products/carrier-board/iris-carrier-board
Viola Carrier: https://www.toradex.com/products/carrier-board/viola-carrier-board
LikeLike
Great article. Just had the chance myself to play with this at the NXP FTF Connects Toronto about 2 weeks ago. I was very much interested in the interaction between the i.MX7 and the M4 core.
We had a hands-on session with the NXP SABRE board. Briefly played with the MU (Messaging Unit) and semaphore unit to coordinate comms between the A7 and M4 core complexes. Very valuable addition for inter-process communications.
We too used UBOOT to lauch (automatically or manually) a custom image. Unfortunately not enough time to go into details. This left me wondering: how can this be done via the eclipse IDE and how do you debug an application running on the M4?
I had a nice chat with Toradex during the lunch break. This coupled with your articles has me checking their website right now.
LikeLike
Hi Ralf,
thanks :-). I think you attended the same training I attended at FTF in Austin/TX this year. I’m trying to replicate the same kind of thing with the Toradex Colibri board, and I’m right now in the process or building the project with Kinetis Design Studio. This works so far. What is missing is to be able to debug it over JTAG. I would like to use either a P&E Multilink or Segger J-Link for this, but on the Iris and Viola board the JTAG connector is not available on the board, I have to check out the full evaluation board. I have the SABRE board too which I need to look at: this one has the connector available.
LikeLike
Dear Erich,
I will begin to work with iMX7 Toradex. I am curious is there support of IDE for Baremetal project on M4? Until now I was working with Kinetis M4 (CodeWarrior, KDS, PEx). There are cases when is suitable to transfer project to iMX7 (original project iMX6 + Kinetis M4). Linux on A7 will handle ethernet, USB and SD Card so there is no need for using RTOS on M4. Is it possible to set up new project for M4 on iMX7 in these variants: RTOS, RTOS + Baremetal (motor driver) or baremetal project only? Is there processor expert support for A7 (BSP) and M4 on iMX7? It would be nice if there would be an article about IDE + JTAG, what projects could be set up, ups/downs. Such options review I am missing. In every forum is discussed only selected option but choosing the right one is hard.
Is there any IDE and project example for embedded linux for A7 or how is usually done linux development for A7? Is necessarily to modify kernel in oder to run ethernet, USB, AUDIO or these peripherals are enabled in preinstalled linux image?
Thank you.
Jaroslav
LikeLike
Hi Jaroslav,
lots of questions 🙂
I’m using Eclipse with GNU ARM Eclipse and the launchpad (actuall Kinetis Design Studio V3.2.0) to build baremetal and RTOS projects for the M4. I’ll plan to publish an article about this probably next weekend (if time permits).
Using FreeRTOS (or any other RTOS) on the M4 is optional, but gives a very nice environment. I have motor applications running with FreeRTOS nicely, because FreeRTOS is is able to work nicely with the interrupts, see my other articles around the ARM Cortex interrupts (https://mcuoneclipse.com/2016/08/14/arm-cortex-m-interrupts-and-freertos-part-1/).
There is no Processor Expert for the Cortex A (well, there is the Pin Muxing for it, see https://mcuoneclipse.com/2016/06/08/tutorial-muxing-with-the-new-nxp-pins-tool/), but not for the drivers.
About IDE and JTAG debugging: I’m not there yet (facing some issues), but that’s definitely my goal, and I will write about it as soon as I have it working.
As for the Linux part: the usual way is to use a pre-built image and flash it to the board (I plan to write an article about this too on the week-end), and then you have pretty much everything in it. But of course you are free to build your own linux image if you want.
I hope this helps,
Erich
LikeLike
Hi Erich,
Thank you for your positive response. I am looking forward to new tutorials.
LikeLike
Hi Erich!
Can you make a post or tutorial (somewhen in future) about bootloader in kinetis boards? I’m getting interested in this area but I can’t even start, it’s so complicated.
LikeLike
Yes, that’s on my (long) list for a long time. So far I’m happy with my own bootloader (which I think is easier to understand): https://mcuoneclipse.com/2013/04/28/serial-bootloader-for-the-freedom-board-with-processor-expert/
LikeLike
Thank you, I read this post but I’ve completely forget about it.
LikeLike
Pingback: Tutorial: Updating Embedded Linux on Toradex i.MX7 Colibri Module using SD Card | MCU on Eclipse
Pingback: Tutorial: First Steps with NXP i.MX7 and Toradex Colibri Board | MCU on Eclipse
Pingback: Tutorial: Building FreeRTOS Applications for ARM Cortex-M4 on i.MX7 with Eclipse | MCU on Eclipse
Just in case: there is tutorial about how to debug the i.MX6 with FreeRTOS here: http://dantechrb.com/blog/how-to-build-and-debug-freertos-applications-for-cortexm4-on-mx6sx
LikeLike
Hi Erich,
Thank you for these articles which are very helpful!
I’m newbie for Linux-Arm and probably missed something.
I fatload .bin file and dcache flush, everything normal, then
under the prompt “colibri iMX7 #” (it’s u-boot 2016.11-2.7.4 )
when I input : bootaux 0x7F8000
response:
##No elf image at address 0x007f8000
## Starting auxiliary core at 0x1FFF8311 …
I guess there must be something wrong with the bin file, so I downloaded pre-compiled ones from Toradex. All the same!
But when I fatload and bootaux .elf file, it works!
response:
## Starting auxiliary core at 0x1FFF8311 …
could you please help me with this problem?
Thank you!
PingQi
LikeLike
Have you contacted Toradex about this already?
LikeLike
Not yet, it’s weekend and I’ll ask the dealers for it the day after tomorrow(Monday) and update here.
I post it here because I thought there could be a obviously answer for a beginner’s question.
Another question (not relevant and probably meaningless) : Does the U-boot print address both in upper case and lower case for purpose? like 0x007f8000 vs 0x1FFF8311 in my last question.
Thank you!
LikeLike
I think it is not on purpose if the addresses are printed in lower or upper case characters.
LikeLike
“when I input : bootaux 0x7F8000
response:
##No elf image at address 0x007f8000
## Starting auxiliary core at 0x1FFF8311 …”
It actually works! I made a stupid mistake that I unconsciously used USB-RS232 instead of USB-UART and received garbage through M4-UART. And luckily nothing is fried.
I checked data read out by J-link after bin file is downloaded into M4’s TCM.
0x1FFF8311 is somewhere inside Reset_Handler and 0x1FFF8000 is the isr_vector。
So the U-boot feedback is slightly different to the document from Toradex but still normal and make sense to me.
So far so good!
LikeLike
great news, and thanks for closing the loop!
LikeLike
Help-me with this (pls)
https://stackoverflow.com/questions/71073386/reading-file-would-overwrite-reserved-memory-failed-to-load-hello-world-bin
https://community.nxp.com/t5/NXP-Designs/Reading-file-would-overwrite-reserved-memory-Failed-to-load/m-p/1406740#M954
LikeLiked by 1 person
Hi Neuber,
I don’t have your hardware, so I cannot check this on my side. My thinking is that the memory map somehow is wrong. I had cases where it has been wrong in the user manual (copy-paste from a previous device), so I would check that first.
LikeLike
How to check memory map? I don’t have JTAG here
LikeLiked by 1 person
Could you check the linker file (ld) and the produced map (.map) file if the memory map makes sense?
LikeLike
Where do I find these files?
LikeLiked by 1 person
the map file is found in the folder where you have built the binary. The linker file is part of the build process, search your source folders for a *.ld file.
LikeLike
I don’t have access to the hardware right now, so I’m not able to reproduce this.
LikeLike
I need one more help. In this issue:
https://stackoverflow.com/questions/71073386/reading-file-would-overwrite-reserved-memory-failed-to-load-hello-world-bin
Mr. @sawdust said to use LMB in U-Boot 2021 to solve my issue.
How to use LMB in U-boot 2021?
LikeLiked by 1 person
I don’t see any references to the LMB in the above link? LMB = Logical Memory Block?
LikeLike
https://stackoverflow.com/questions/71073386/reading-file-would-overwrite-reserved-memory-failed-to-load-hello-world-bin
How did you not see? friend
Mr. sawdust talks about LMB in his last comment. from him.
Could you help me to implement this kind of DEBUG(LMB) in U-boot 2021. Ok?
LikeLike
Hi,
I need your help here:
https://community.toradex.com/t/imx7d-5-4-x-kernel-launching-m4-fw-using-remoteproc/12455/53?page=2
WHere I stay using kernel 4.XX with issue in baudrate (see last mensages)
And here:
https://community.nxp.com/t5/NXP-Designs/virtio-rpmsg-bus-virtio0-msg-received-with-no-recipient/m-p/1437807#M964
My issue with hardknot/yocto/5.10 kernel is:
virtio rpmsg bus virtio0: msg received with no recipient
LikeLike
Unfortunately, I don’t have that board any more available, so I cannot verify things or try out something. 😦
LikeLike