下载官方SDK
SDK_2.5.0_EVK-MIMX8MM:https://mcuxpresso.nxp.com/en/dashboard?uvid=172537,需要登陆
编译参考手册:《docs/Getting Started with MCUXpresso SDK for i.MX 8M Mini.pdf》-《5 Run a demo using ARM® GCC》
安装编译链
下载:gcc-arm-none-eabi-7-2017-q4-major-linux.bz2
https://download.csdn.net/download/sunluyao_/10415737,陈熙使用的CSDN会员帮忙下载
解压并安装:
tar -xvf gcc-arm-none-eabi-7-2017-q4-major-linux.bz2
export ARMGCC_DIR=/home/logread/imx8/cortex-M4/gcc-arm-none-eabi-7-2017-q4-major
export PATH=$PATH:/home/logread/imx8/cortex-M4/gcc-arm-none-eabi-7-2017-q4-major/bin
logread@logread:~/imx8/cortex-M4$ arm-none-eabi-gcc -v
Thread model: single
gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major)
编译文件
测试程序目录:<install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc
/home/logread/imx8/cortex-M4/SDK_2.5.0_EVK-MIMX8MM/boards/evkmimx8mm/demo_apps/hello_world/armgcc
$ ./build_release.sh
release/ hello_world.bin hello_world.elf
跑demo
tftp 0x7e0000 hello_world.bin
bootaux 0x7e0000
M4打印hello world.
查看文件
file release/hello_world.elf
release/hello_world.elf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped
file release/hello_world.bin
release/hello_world.bin: data
在板子运行
root@OpenWrt:/# /tmp/hello_world.elf
Segmentation fault,需要用jlink和gdb跑这个程序
使用Open编译链
export ARMGCC_DIR=/home/logread/imx8/openwrt/staging_dir/toolchain-aarch64_cortex-a53+neon_gcc-8.3.0_musl
export PATH=$PATH:/home/logread/imx8/openwrt/staging_dir/toolchain-aarch64_cortex-a53+neon_gcc-8.3.0_musl/bin
/home/logread/imx8/cortex-M4/SDK_2.5.0_EVK-MIMX8MM/tools/cmake_toolchain_files/armgcc.cmake:24:SET(TARGET_TRIPLET "arm-none-eabi")
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mthumb'
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mthumb'
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mthumb'
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mapcs'; did you mean '--specs'?
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mapcs'; did you mean '--specs'?
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mapcs'; did you mean '--specs'?
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mthumb'
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mapcs'; did you mean '--specs'?
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mfloat-abi=hard'
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mfloat-abi=hard'
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mfloat-abi=hard'
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mfloat-abi=hard'
aarch64-openwrt-linux-gcc: error: unrecognized command line option '-mfpu=fpv4-sp-d16'