xr32f429开发环境搭建
XR32是全志科技的一款MCU芯片,基本参数如下所示:
环境的搭建首先是下载芯片对应的资料和手册(QQ群723687715)软硬件资料
官网工具下载:注册全志服务平台
下载无线连接工具和无线MCU 工具
资料下载后下载芯片的SDK包:https://gitee.com/GloomyGhost/xr32-sdk
然后在linux下根据SDK包中的帮助文档进行开发环境的配置
打开终端根据Readme文档的## Install necessary packages说明进行包的安装(每一个都需要安装)
安装完成之后在下载的SDK包中运如sh文件
正常运行的结果如下所示:
1 guy@guy-X9Ti:~/XR32/xr32-sdk(只读)$ ./setup_toolchain.sh 2 =======================Setup Toolchain======================= 3 --2023-02-28 19:07:29-- https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q2-update/+download/gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2 4 正在解析主机 launchpad.net (launchpad.net)... 185.125.189.222, 185.125.189.223, 2620:2d:4000:1001::8004, ... 5 正在连接 launchpad.net (launchpad.net)|185.125.189.222|:443... 已连接。 6 已发出 HTTP 请求,正在等待回应... 303 See Other 7 位置:https://launchpadlibrarian.net/209776202/gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2 [跟随至新的 URL] 8 --2023-02-28 19:07:30-- https://launchpadlibrarian.net/209776202/gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2 9 正在解析主机 launchpadlibrarian.net (launchpadlibrarian.net)... 185.125.189.228, 185.125.189.229, 2620:2d:4000:1001::8007, ... 10 正在连接 launchpadlibrarian.net (launchpadlibrarian.net)|185.125.189.228|:443... 已连接。 11 已发出 HTTP 请求,正在等待回应... 200 OK 12 长度: 73684786 (70M) [application/x-tar] 13 正在保存至: ‘gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2’ 14 15 gcc-arm-none-eabi-4_9-2015q2-201 100%[==========================================================>] 70.27M 2.63MB/s 用时 29s 16 17 2023-02-28 19:08:01 (2.39 MB/s) - 已保存 ‘gcc-arm-none-eabi-4_9-2015q2-20150609-linux.tar.bz2’ [73684786/73684786]) 18 19 =======================Unarchive Toolchain======================= 20 =======================Add Toolchain======================= 21 =======================Add Toolchain path======================= 22 =======================Set Tools======================= 23 =======================ALL Done!======================= 24 guy@guy-X9Ti:~/XR32/xr32-sdk(只读)$
安装完成之后需要代码进行编译,直接用SDK中的案例代码
字节修改在while中需要执行的动作,最简单的打印一条日志到串口中,在gcc目录中打开终端执行make build
执行成功的话最终的结果如下:
编译完成之后在如下文件夹中会生成固件
编译完成之后就是代码的下载:配置后串口的参数
将生成的固件放到当前文件夹中,链接好串口线,将开发板的PB03引脚拉低,然后将PB02引脚拉底,然后按下复位键,松开复位键后拉高PB02,然后开发板进入升级模式(芯片没有代码的话直接下载)
终端执行如下操作:
运行过程如下:
1 guy@guy-X9Ti:~/XR32/xradio_wireless_mcu_tools_package_v1.0.4/xradio_phoenixMC_v3.1.21014b-p1$ sudo ./phoenixMC 2 3 Version: v1.2.00815b(by notebook) 4 phoenixMC_u -A [debug flash address] (default: 0x00000000) 5 phoenixMC_u -b [baud rate] (default: 921600) 6 phoenixMC_u -B [flash debug bin file for write] (default: a.bin) 7 phoenixMC_u -c [com dev] (default: /dev/ttyUSB0) 8 phoenixMC_u -C [config file] (default: ./settings.ini) 9 phoenixMC_u -d [debug log level] (default: 0) 10 phoenixMC_u -D [debug flash mode] (default: n=NULL) 11 phoenixMC_u -e [enable etf image] (default: 0) 12 phoenixMC_u -f [enable flash compat] (default: 1) 13 phoenixMC_u -g [enable combine images] 14 phoenixMC_u -G [combine image path] (default: combine_image.cimg) 15 phoenixMC_u -h [help msg] 16 phoenixMC_u -i [wlan image path] (default: xr-system.img) 17 phoenixMC_u -I [ETF image path] (default: xr-system_etf.img) 18 phoenixMC_u -l [log file path] (default: ./log/log.txt) 19 phoenixMC_u -L [debug flash length] (default: 0x00000200) 20 phoenixMC_u -r [read and check after write] (default: 0) 21 phoenixMC_u -s [show image info] 22 phoenixMC_u -u [update changed blocks only] (default: 1) 23 phoenixMC_u -v [show version] 24 25 When it's upgrading, input 'stop' to stop it if you need. 26 --------------SETTING-------------- 27 COM:/dev/ttyUSB0 28 Baud:921600 29 Log path:./log/log.txt 30 Log level:0 31 Image path:./xr_system.img 32 ETF image path:./xr_system_etf.img 33 Read and check:NO 34 Update change only:YES 35 Program ETF image:NO 36 Use flash compat:YES 37 38 ************************************************* 39 firmware information 40 ************************************************* 41 ******************************************************************************************************************* 42 bin version: 3 43 bin count: 3 44 No. ID sram_offs data_size next_section attribute private 45 1 0xA5FF5A00 0x00067000 0x00007570 0x00008000 0x00000001 0xFFFFFFFFFFFFFFFFFFFFFFFF 46 2 0xA5FE5A01 0x00010000 0x0000B384 0x00053000 0x00000001 0xFFFFFFFFFFFFFFFFFFFFFFFF 47 3 0xA5F75A08 0x60000000 0x00000000 0xFFFFFFFF 0x00000001 0xFFFFFFFFFFFFFFFFFFFFFFFF 48 ******************************************************************************************************************* 49 50 not Combined image!! 51 3%: Opening com... 52 10%: Checking the 1 block,total 5 block(s)... 53 10%: Erasing the 1 block,total 5 block(s)... 54 14%: Writing the 1 block,total 5 block(s)... 55 26%: Checking the 2 block,total 5 block(s)... 56 26%: Erasing the 2 block,total 5 block(s)... 57 30%: Writing the 2 block,total 5 block(s)... 58 42%: Checking the 3 block,total 5 block(s)... 59 58%: Checking the 4 block,total 5 block(s)... 60 74%: Checking the 5 block,total 5 block(s)... 61 90%: Checking rest data of 64k... 62 guy@guy-X9Ti:~/XR32/xradio_wireless_mcu_tools_package_v1.0.4/xradio_phoenixMC_v3.1.21014b-p1$
下载完成之后复位开发板,打开串口查看打印的信息
到此基本环境搭建完成。
如有问题评论区实时解答。
有你相伴此生无憾!