Monday, 6 September 2021

openOCD Debug STM32

If working remotely, everything is terminal. No GUI like stm32cubeide to use for firmware debugging. I need to use openOCD now. I am using a stm32f407 discovery board for the following tests.

1. install openOCD
sudo apt-get install openocd
cd /usr/local/share 
sudo ln -s /usr/share/openocd .

2. install toolchain
sudo apt install gcc-arm-none-eabi

3. install stm32cubeMX
Generate a project with makefile.

4. go the project directory and make the project.

5. make a cfg file

cd /usr/local/share/openocd/scripts/board

boris@boris-T420:/usr/local/share/openocd/scripts/board$ sudo cp stm32f4discovery.cfg stm32f407discovery_boris.cfg

6. Terminal 1: launch openOCD to connect to the board

openocd -f /usr/local/share/openocd/scripts/board/stm32f407discovery_boris.cfg

You can see the following problem:


7. edit the cfg file


Now it works:


8. Terminal 2: start GDB

go to the project directory, go to build/

PATH/TO/PROJECT/build$ arm-none-eabi-gdb openocd_practice.elf



9. now in gdb teminal, start debuging:
ref:
https://www.youtube.com/watch?v=yDNbpXjWAuU&ab_channel=AimalKhan



ref:

https://www.youtube.com/watch?v=yDNbpXjWAuU&ab_channel=AimalKhan
https://www.youtube.com/watch?v=Df7gtGyQaxg&t=512s&ab_channel=EmbeddedTips
http://forum.chibios.org/viewtopic.php?t=3425
https://elinux.org/OpenOCD_Ubuntu_Package

Friday, 3 September 2021

First Time Setting New MT7688 Module

 Got a new module, how to set network easily?

1. Connect your PC to the WAN port.

2. Serial connect to the board:

$ screen /dev/ttyUSB0 57600

$ ifconfig

br-lan Link encap:Ethernet HWaddr 1C:88:79:56:43:0F
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fd40:27d8:7c5f::1/60 Scope:Global
inet6 addr: fe80::1e88:79ff:fe56:430f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1333 errors:0 dropped:0 overruns:0 frame:0
TX packets:1284 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:92554 (90.3 KiB) TX bytes:106278 (103.7 KiB)

3. Go back to PC and open a browser, put down 192.168.1.1

Default password is root.