本篇主要介绍如何建立imxRT的软件调试环境,即GCC+GDB+JLinkGDBServer,以期进行程序编写、软件调试,
系统需求
OS:LINUX Ubuntu 14.04 or higher
Platform:MIMXRT1050-EVK Board
调试环境搭建
- Install the Jlink gdb sever + arm-none-eabi-gdb do debug the Code
- Type sudo apt-get install gdb-arm-none-eabi, then the gdb will be installed directly in you system, if it does not work, try to download the gcc-arm-none-eabi-7-2017-q4-major-src.tar.bz2 from ARM Developer website. Do not download the latest version. You may meet some issues with the newest one!
- Download J-Link Software and Documentation pack for linux, TGZ archive, 64-bit[Beta] from Segger Jlink website and unzip.
- Build the gcc-arm-none-eabi, you can follow “How to build toolchain.pdf”, if you use Sudo apt-get to install the gdb, Please ignore the step below.
- Export TOOLCHAIN_DIR=…your directory…/gcc-arm-none-eabi-7-2017-q4-major/install-native/
- Export ARMGCC_DIR=…your directory…/gcc-arm-none-eabi-7-2017-q4-major/install-native/
- Download the i.MXRT SDK ( EVKB-IMXRT1052 armgcc version ) from NXP website
调试运行程序
- Cd to the armgcc folder in EVK-IMXRT1052/boards/evkbimxrt1050/demo_apps/hello_world, or you can choose anyone you like to build , type ./clean.sh before type ./build_sdram_debug.sh to build the project, then you will get a .elf in the folder sdram_debug. ( means the name of the elf), or you can test another command-script, to build different version-code->run in SDRAM or in RAM, have fun!
- Run J-link GDB server
- cp libjlinkarm.so.* /usr/lib
- cp 99-jlink.rules /etc/udev/rules.d
- cd to the path you place the J-Link software, and type ./JLinkGDBServer -device MCIMXRT1052 -if SWD -speed 4000 -JlinkScriptFile ./ evkmimxrt1050_sdram_init.jlinkscript (you can find this file in the path ./hello_world)
- cd to the path where you place the *.elf and Run arm-none-eabi-gdb
- Type target remote 127.0.0.1:2331
- Type file *.elf
- Type load
Then we can use gdb to debug the source code, you can try Some commands like this:- c : run the code
- s : single step
- n : next step
- Connect the EVK to the PC through the usb cable to watch the result
- To do that , maybe you will install a series port tester, in linux you can try minicom, type sudo apt-get install minicom
- Type sudo minicom -s to setup the serial port, in linux named ttyACM0, and the baud-rate is 115200, then save your configuration.
- Type c in the gdb console to run the code and you will see the result in the minicom.
结束语
在本文中,跟大家简单分享了一下在imxRT上搭建软件调试环境的基本流程,算是后续程序移植的先遣兵,打下了基础!后续,还会陆续更新一些机器学习相关的环境搭建部署,如:CMSIS-NN、ARM-NN、COMPUTE-LIBREARY等ARM官方软件库,主要集中在环境的搭建、代码编译移植,即如何让这些库在我们的imx系列芯片上飞奔起来,让机器学习在imx系列上生根发芽,让AI不仅仅能够在MPU上运行,在小小的MCU单片机上也能够实现!当然,这些我们现在都已经实现了,请看官们等候小编陆续更新!欢迎留言骚扰,一起讨论学习!
未完待续。。。。
PS:转载请注明出处