这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » STM32 » 【STM32H747I-DISCO|Zephyr】体验hellowld

共1条 1/1 1 跳转至

【STM32H747I-DISCO|Zephyr】体验hellowld

高工
2025-12-24 20:22:39     打赏

【前言】

Zephyr已经支持STM32H747的官方开发板,可以快速的实现入门。本篇将分享如何快速体验hello wold。

【开发环境】

1、wsl2

2、west

【实现步骤】

1、复制hello world工程

~/zephyrproject/app/stm32h747$ cp -r ~/zephyrproject/zephyr/samples/hello_world/ hello_world

2、加载虚拟环境:

~/zephyrproject/app/stm32h747/hello_world$ source ~/zephyrproject/zephyr/zephyr-env.sh

3、进入hello world工程,执行编译:

west build -b stm32h747i_disco/stm32h747xx/m7

这里注意的是,一定要指定编译哪个内核。

编译的结果如下:

-- west build: building application
[1/153] Preparing syscall dependency handling

[3/153] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.3.0 (/home/lugl/zephyrproject/zephyr), build: v4.3.0
[153/153] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       18900 B         1 MB      1.80%
             RAM:        4608 B       512 KB      0.88%
          EXTMEM:          0 GB        64 MB      0.00%
           SRAM0:          0 GB       512 KB      0.00%
           SRAM1:          0 GB       128 KB      0.00%
           SRAM2:          0 GB       128 KB      0.00%
           SRAM3:         16 KB        32 KB     50.00%
           SRAM4:          0 GB        64 KB      0.00%
          SDRAM2:          0 GB        32 MB      0.00%
        IDT_LIST:          0 GB        32 KB      0.00%
Generating files from /home/lugl/zephyrproject/app/stm32h747/hello_world/build/zephyr/zephyr.elf for board: stm32h747i_disco

4、下载,需要在windows下面的powrshell下面执行

usbipd bind --busid 4-3 --force
usbipd attach --wsl --busid 4-3

image.png

然后在wsl查看:

lugl@lugl:~/zephyrproject/app/stm32h747/hello_world$ lsusb | grep -i "0483:374e"
Bus 001 Device 002: ID 0483:374e STMicroelectronics STLINK-V3

5、下载

west flash --runner openocd

【出问题了】

下载后出现

Error: stm32h7x.cpu0 -- clearing lockup after double fault
target halted due to debug-request, current mode: Handler Reset
xPSR: 0xa05f0001 pc: 0xa05f0001 msp: 0xa05f0001
Polling target stm32h7x.cpu0 failed, trying to reexamine
Info : stm32h7x.cpu0: hardware has 0 breakpoints, 10 watchpoints
Info : stm32h7x.cpu0: external reset detected
shutdown command invoked

估计是M4内核没有初始化,准备下载stm32cubeprograme,将M4内核关闭然后再看看。




关键词: STM32H747I-DISCO     Zephyr    

共1条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]