2018年4月10日本周四,分享主题 ARM Cortex-M 在 Linux 下的开发

54 views
Skip to first unread message

Rafael Lee

unread,
Apr 10, 2018, 9:54:50 AM4/10/18
to Shenzhen DIY community
ARM Cortex-M 在 Linux 下的开发

主要介绍开发环境搭建,工具链的使用,如何抛弃 IDE,在 Shell 下优雅高效地地开发 Cortex-M 的程序,以 STM 32 为例。

已经可以像开发 PC 程序那样开发 STM32 的程序了。

Slide 和描述正在准备,稍后附上。

Rafael Lee

unread,
Apr 10, 2018, 12:07:03 PM4/10/18
to Shenzhen DIY community
提纲:

* Development ARM Cortex-M software under linux.

** Linux 下的 Cortex-M 开发工具链
甩开工具链的束缚。用全自由软件开发 Cortex-M 程序。
使用的工具有

compiler: gcc-arm-none-eabi
debugger: gdb-arm-none-eabi

gef

hardware debugger:
  blackmagic probe debugger 或者 ST-Link

emacs

gtags

make

如果需要查看外设寄存器状态,需要 eclipse 和 embsysregview 插件。



** 创建一个工程



** 下载并调试



** GEF / GDB 介绍


gdb:
conditional breakpoint, 实际上每次 CPU 都会在断点停住,然后由 MCU 和 PC 通讯,判断条件是否达到。
   b rsa.c:745 if ilen < 0x20000000

watchpoint
   awatch *0xE000ED04 SCB_ICSR



* Development ARM Cortex-M software under linux.

** Linux 下的 Cortex-M 开发工具链
甩开工具链的束缚。用全自由软件开发 Cortex-M 程序。
使用的工具有

compiler: gcc-arm-none-eabi
debugger: gdb-arm-none-eabi

gef

hardware debugger:
  blackmagic probe debugger 或者 ST-Link

emacs

gtags

make

如果需要查看外设寄存器状态,需要 eclipse 和 embsysregview 插件。



** 创建一个工程



** 下载并调试



** GEF / GDB 介绍


gdb:
conditional breakpoint, 实际上每次 CPU 都会在断点停住,然后由 MCU 和 PC 通讯,判断条件是否达到。
   b rsa.c:745 if ilen < 0x20000000

watchpoint
   awatch *0xE000ED04 SCB_ICSR



* Development ARM Cortex-M software under linux.

** Linux 下的 Cortex-M 开发工具链
甩开工具链的束缚。用全自由软件开发 Cortex-M 程序。
使用的工具有

compiler: gcc-arm-none-eabi
debugger: gdb-arm-none-eabi

gef

hardware debugger:
  blackmagic probe debugger 或者 ST-Link

emacs

gtags

make

如果需要查看外设寄存器状态,需要 eclipse 和 embsysregview 插件。



** 创建一个工程



** 下载并调试



** GEF / GDB 介绍


gdb:
conditional breakpoint, 实际上每次 CPU 都会在断点停住,然后由 MCU 和 PC 通讯,判断条件是否达到。
   b rsa.c:745 if ilen < 0x20000000

watchpoint
   awatch *0xE000ED04 SCB_ICSR

*****************************************************************
附图一张:使用 GEF 在 BASH 下调试,可以看到所有寄存器,指定区域的内存,源代码,及堆栈信息。




在 2018年4月10日星期二 UTC+8下午9:54:50,Rafael Lee写道:

Terry Ouyang

unread,
Apr 10, 2018, 11:19:54 PM4/10/18
to SZDIY
太好了,虽然还没有时间玩,以后有时间的时候就可以跟着做了。

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to
szdiy+unsubscribe@googlegroups.com
For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+unsubscribe@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

张鹏

unread,
Apr 12, 2018, 12:09:47 AM4/12/18
to sz...@googlegroups.com
今晚過來學習一下!

Terry Ouyang <terry....@gmail.com> 于2018年4月11日周三 上午3:19写道:
太好了,虽然还没有时间玩,以后有时间的时候就可以跟着做了。


For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

杨城

unread,
Apr 12, 2018, 10:01:39 PM4/12/18
to sz...@googlegroups.com
我计划购买BlockMagic,方舟兄弟,请提供一下你淘宝的网址。
同时还有哪位兄弟需要的说一声,我一起买了节省邮费。

杨城

在 2018年4月11日 上午12:07,Rafael Lee <rafael...@gmail.com>写道:

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+unsubscribe@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

Aaron Xu

unread,
Apr 12, 2018, 10:55:43 PM4/12/18
to sz...@googlegroups.com
昨晚没去, BlockMagic是啥? @杨城

杨城

unread,
Apr 12, 2018, 11:24:27 PM4/12/18
to sz...@googlegroups.com
一个开源JTAG类的开发工具

unread,
Apr 12, 2018, 11:25:56 PM4/12/18
to sz...@googlegroups.com
是 Black Magic,黑魔法。
还有其他叫这名字的品牌、产品(

杨城

unread,
Apr 12, 2018, 11:28:10 PM4/12/18
to sz...@googlegroups.com
哦,没有注意我拼写错误了,抱歉

Rafael Lee

unread,
Apr 13, 2018, 12:15:11 AM4/13/18
to sz...@googlegroups.com
Black Magic Probe
是用一块最便宜的 STM32103C8T6 的开发板自己做的。没有淘宝地址。
要么我下周做好了带给你吧。开发板我这有多的。

哦,没有注意我拼写错误了,抱歉
您收到此邮件是因为您订阅了Google网上论坛上“Shenzhen DIY community”群组中的主题。
要退订此主题,请访问https://groups.google.com/d/topic/szdiy/YWCXKY6vaFY/unsubscribe
要退订此群组及其所有主题,请发送电子邮件到szdiy+unsub...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

Aaron Xu

unread,
Apr 13, 2018, 12:21:48 AM4/13/18
to sz...@googlegroups.com
意思是说有 STM32103C8T6 的那款开发板就可以?如果必须要硬件的话,那下周我也要一个。

哦,没有注意我拼写错误了,抱歉
要退订此群组及其所有主题,请发送电子邮件到szdiy+unsubsc...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

杨城

unread,
Apr 13, 2018, 12:56:08 AM4/13/18
to sz...@googlegroups.com
就是这个 STM32103C8T6开发板的淘宝链接,我想法是如果还有兄弟要,我就一次买上四或五片,有谁想用的就从我这里拿。

在 2018年4月13日 下午12:15,Rafael Lee <rafael...@gmail.com>写道:
哦,没有注意我拼写错误了,抱歉
要退订此群组及其所有主题,请发送电子邮件到szdiy+unsubsc...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

Rafael Lee

unread,
Apr 13, 2018, 1:04:22 AM4/13/18
to sz...@googlegroups.com
https://item.taobao.com/item.htm?&id=523959965779
我已经又买了5片了。刚收到货。


要退订此群组及其所有主题,请发送电子邮件到szdiy+unsub...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

杨城

unread,
Apr 13, 2018, 1:24:00 AM4/13/18
to sz...@googlegroups.com
我也买5片吧,这样可以在DIY放一堆板子了。哈哈哈

Rafael Lee

unread,
Apr 13, 2018, 5:57:15 AM4/13/18
to sz...@googlegroups.com
买多了浪费。

我也买5片吧,这样可以在DIY放一堆板子了。哈哈哈
要退订此群组及其所有主题,请发送电子邮件到szdiy+unsub...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

杨城

unread,
Apr 14, 2018, 10:36:53 PM4/14/18
to sz...@googlegroups.com
我买了二片,你的意见是对的。因为我们不需要这么多Black Magic Probe,我会自己留一片另一片放在DIY,有需要的人可以借用。但现在需要请教你如何烧录,或者等聚会时看你具体操作。

Nala Ginrut

unread,
Apr 15, 2018, 12:42:01 AM4/15/18
to sz...@googlegroups.com
如果我们需要很多,说明我们水平不行

杨城 <gump...@gmail.com> 于 2018年4月15日周日 10:36写道:
买多了浪费。

我也买5片吧,这样可以在DIY放一堆板子了。哈哈哈

https://item.taobao.com/item.htm?&id=523959965779
我已经又买了5片了。刚收到货。


哦,没有注意我拼写错误了,抱歉

一个开源JTAG类的开发工具

昨晚没去, BlockMagic是啥? @杨城


For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上“Shenzhen DIY community”群组中的主题。
要退订此主题,请访问https://groups.google.com/d/topic/szdiy/YWCXKY6vaFY/unsubscribe
要退订此群组及其所有主题,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上“Shenzhen DIY community”群组中的主题。
要退订此主题,请访问https://groups.google.com/d/topic/szdiy/YWCXKY6vaFY/unsubscribe
要退订此群组及其所有主题,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上“Shenzhen DIY community”群组中的主题。
要退订此主题,请访问https://groups.google.com/d/topic/szdiy/YWCXKY6vaFY/unsubscribe
要退订此群组及其所有主题,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

--
--
You received this message because you are subscribed to the Google
Groups "Shenzhen DIY community" group.
To post to this group, send email to sz...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://www.szdiy.org
http://groups.google.com/group/szdiy?hl=zh-CN
---
您收到此邮件是因为您订阅了Google网上论坛上的“Shenzhen DIY community”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到szdiy+un...@googlegroups.com
要查看更多选项,请访问https://groups.google.com/d/optout

david pan

unread,
Aug 10, 2018, 12:34:18 AM8/10/18
to sz...@googlegroups.com
这两天把这个坟挖了一下,制作了个black magic probe,觉得挺好的,支持JTAG,理论上可以当作一个便宜的通用调试器(< 10 RMB)调试所有支持JTAG的芯片(esp32尽然就是个例外,有JTAG接口但ESP没有提供完整支持。。。),支持SWD,ARM架构的芯片调试只需要三根线,内建GDB server 一个串口,PC上一个USB口就搞定,也不用折腾openOCD一类的东西了, 还有就是跨平台免驱使用(win7还需要安装驱动),识别为两个串口,一个是做GDB server,一个做printf串口。

另外,要支持gef,需要gdb支持python, 得重新build一下, 我在mac上是这样做的:

========================
//get 最新的gdb source

//解压
tar xzvf gdb-8.1.1.tar.gz

//创建build目录
mkdir gdb-build
cd gdb-build

//configure, make & make install
../gdb-8.1.1/configure --target=arm-none-eabi --prefix=$YOUR_INSTALL_PATH  --enable-interwork --enable-multilib --with-multilib-list=rmprofile --with-python

make

make install
==============================

export $YOUR_INSTALL_PATH/bin后,就可以调用arm-none-eabi-gdb了,已经安装过gef就默认调起gef

Rafael Lee

unread,
Aug 23, 2018, 12:26:12 PM8/23/18
to Shenzhen DIY community
# -*- GDB-Script -*-
# "file" should place before "target"
# file build/sample.elf
# file /run/shm/d/workspace/STM32F103C8_TEST_8M/SW4STM32/STM32F103C8_TEST_8M/Debug/STM32F103C8_TEST_8M.elf

# set debug arm # only for gdb-multiarch

file build/read_program_in_flash.elf
target remote localhost:3333

# target extended-remote /dev/ttyACM0
# monitor swdp_scan
# attach 1
load

# gdb settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
alias -a di = disas
# alias -a dis = disas
# alias -a disa = disas
alias -a tb = tbreak
# gdb settings vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

################################################################################

# gef settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# with capstone and keystone setup
gef config context.layout "regs stack code args source threads trace extra memory"
# gef config context.layout "regs stack -code -args source threads trace extra memory"
# gef config context.layout "regs stack -code -args source trace extra memory"
# gef config context.layout "stack -code -args source trace extra memory"
# gef config context.layout "regs source memory"

gef config context.nb_lines_code 8
gef config context.redirect "/dev/pts/0"

layout split
tui disable

# gef settings vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

################################################################################

# debug ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

set $pc = *0x20000004
set $sp = 0x20005000


# trace enable bit in DEMCR register
# TPIU module -> DEMCR& = 1 << TRCENA
# DEMCR MON_STEP
# DEMCR MON_EN

# PM0056 Programming manual
#     describe registers
#     CPS, CPUID

# watch CPU SCB registers
# CPUID ICSR VTOR AIRCR SCR CCR SHPR1 SHPR2 SHPR3 CSFR
memory watch 0xe000ed00 10 dword


# stack
memory watch 0x20004FC0 64 byte

# DWT_CTRL and DWT_CYCCNT described ARM® v7-M Architecture Reference Manual
# DWT_CTRL bit CYCCNTENA (bit 1) is set, CYCCNT works
# DWT_CTRL bit CPIEVTENA (bit 17) is set, DWT_CPICNT works
# DWT_CTRL DWT_CYCCNT DWT_CPICNT DWT_SLEEPCNT DWT_LSUCNT DWT_FOLDCNT

memory watch 0xE0001000 3 dword
# set *0xE0001000=(*0xE0001000) & 0x1
# set *0xE0001000=(*0xE0001000) & (0x20000)
set *0xE0001000 = 0x20001
# reset DWT_CYCCNT value
set *0xE0001004 = (long int)0x0
set *0xE0001008 = (long int)0x0

# Debug registers
# DFSR 0xE000ED30
# DHCSR 0xE000EDF0
# DCRSR 0xE000EDF4
# DCRDR 0xE000EDF8
# DEMCR 0xE000EDFC bit 24, TRCENA, Trace Enable

# C1.5 Debug event behavior
# C1.6 Debug register support in the SCS
# ARMv7-M Architecture Reference Manual(ARMv7-M_ARM).pdf
# DHCSR DCRSR DCRDR DEMCR
#   DHCSR: bit2 C_STEP, bit1 C_HALT
memory watch 0xE000EDF0 4 dword


# clear memory aroud stack
set *0x20004fb0=(long int)0x0
set *0x20004fb4=(long int)0x0
set *0x20004fb8=(long int)0x0
set *0x20004fbc=(long int)0x0

set *0x20004fc0=(long int)0x0
set *0x20004fc4=(long int)0x0
set *0x20004fc8=(long int)0x0
set *0x20004fcc=(long int)0x0

set *0x20004fd0=(long int)0x0
set *0x20004fd4=(long int)0x0
set *0x20004fd8=(long int)0x0
set *0x20004fdc=(long int)0x0

set *0x20004fe0=(long int)0x0
set *0x20004fe4=(long int)0x0
set *0x20004fe8=(long int)0x0
set *0x20004fec=(long int)0x0

set *0x20004ff0=(long int)0x0
set *0x20004ff4=(long int)0x0
set *0x20004ff8=(long int)0x0
set *0x20004ffc=(long int)0x0

# set *0xE000EDF0=

# set PC counter in ETM/ TPIU


# break point 1
# command 1
# print "^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
# print "^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
# print $pc
# bt
# print "^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
# print "^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
# end
# # break point 2
# command 2
# print "^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
# print "^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
# print $pc
# btp
# print "^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
# print "^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^
# end

# b *((main) +14)
# b *0x80003160

# after command MSP
# b *(reset+30)
# command
# set $sp=0x20004FFC
# end


# **********************************************************
# 0x080012e0 <+64>:    bl      0x8002370
# tb *0x8002370
b *(entry+64)
# 0x080012e4 <+68>:    bl      0x8002350
# tb *0x8002350
b *(entry+68)
# # "bl gpio_init\n\t"
# 0x080012e8 <+72>:    bl      0x8001cf0
# tb *0x8001cf0
b *(entry+72)

# **********************************************************
# "bl     gpio_init\n\t"
# 0x0800f462
# 0xe0042000 DBGMCU_IDCODE, in RM0008 chapter 31.6.1
# awatch *(int*)0xE000ED04
# awatch *0xE000ED04 SCB_ICSR
# awatch -l *(uint32_t *)0xe0042000
# b *(main+48)
# b *0x080013e4
# c
# command
# disassemble 'foo.c'::bar
# end
# entry -> main
# halt
# hit breakpoint main
# loop here
# msr    CONTROL, r1
# reset
# set $pc 0x8003268
# set $pc to reset()
# set $sp=0x20004FFC
# tb main
# tbreak *(entry+88)
# tbreak *0x8002168
# trace-run *0x0800fc30
# trace-run *0x080122e0
# trace-run *0x08013110
# trace-run *0x8013110
# trace-run 0x0800fc84
# trace-run 0x8005574
# watch *(int*)0xE000ED04
# watch -l *0xE000ED04


# debug vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Reply all
Reply to author
Forward
0 new messages