yiguangl-56946 发表于 2019-5-28 07:20:51

Ubuntu18.04使用stlink连接stm32h743

我从http://github.com/texane/stlink下载了linux 下的stlink,但该版本并没有stm32h743的支持,估计是该器件太新了。然后我尝试移植一下,目前我已经把chipid,flash信息,brom信息等填进去,但发现还需要一段汇编程序flashloaders,这个可以参考哪些地方得到?
如下是stm32 f7的flashloaders:
.global start
.syntax unified

@ r0 = source
@ r1 = target
@ r2 = wordcount
@ r3 = flash_base
@ r4 = temp

start:
    ldr   r3, flash_base
next:
    cbz   r2, done
    ldr   r4,
    str   r4,
    dsb   sy

wait:
    ldrh    r4,
    tst.w   r4, #1
    bne   wait

    add   r0, #4
    add   r1, #4
    sub   r2, #1
    b       next
done:
    bkpt

.align 2

flash_base:
        .word 0x40023c00


然后代码里还有一段这样的:
        static const uint8_t loader_code_stm32f7[] = {
      // flashloaders/stm32f7.s
      0x08, 0x4b,
      0x72, 0xb1,
      0x04, 0x68,
      0x0c, 0x60,
      0xbf, 0xf3, 0x4f, 0x8f,      // DSB Memory barrier for in order flash write
      0xdc, 0x89,
      0x14, 0xf0, 0x01, 0x0f,
      0xfb, 0xd1,
      0x00, 0xf1, 0x04, 0x00,
      0x01, 0xf1, 0x04, 0x01,
      0xa2, 0xf1, 0x01, 0x02,
      0xef, 0xe7,
      0x00, 0xbe,                   //   bkpt        #0x00
      0x00, 0x3c, 0x02, 0x40,
    };


代码我都看得懂,我只是想知道怎么移一款新的MCU,或从哪里得到支持信息?
有搞过这个的朋友支持下吗?

wofei1314 发表于 2019-5-28 10:16:01

不懂帮顶~

你走在了我们的前端:lol

tanic 发表于 2019-5-28 11:06:33

STM32IDElinux版本应该集成了

tanic 发表于 2019-5-28 11:07:03

把STM32全家桶装一下:lol

catfan8888 发表于 2019-10-22 09:57:00

可以用python的工具

sudo apt-get install libusb-dev python-usb
git clone http://github.com/pavelrevak/pystlink.git
sudo -H pip install pyusb
./pystlink flash:erase:verify:foo.bin

如果有以下错误

Traceback (most recent call last):
File "./pystlink.py", line 4, in <module>
    import lib.stlinkusb
File "/home/yanghai/tools/pystlink/lib/stlinkusb.py", line 1, in <module>
    import usb.core
ModuleNotFoundError: No module named 'usb'

再运行这个

sudo apt-get install python3-pip
sudo -H python3-pip install pyusb
页: [1]
查看完整版本: Ubuntu18.04使用stlink连接stm32h743