STM32F4Discovery上手

剛入手STM32F4Discovery,火燒眉毛的開始入門摸索...*git

##開發環境搭建 我是基於Mac OS X 10.10.4的PC環境github

  1. 使用brew安裝依賴工具
sudo brew install libusb autogen automake wget pkg-config
  1. 安裝st-link
➜  stlink git:(master) $./st-util
   2015-07-02T19:40:19 INFO src/stlink-usb.c: -- exit_dfu_mode
   2015-07-02T19:40:19 INFO src/stlink-common.c: Loading device parameters....
   2015-07-02T19:40:19 INFO src/stlink-common.c: Device connected is: F4 device, id 0x10016413
   2015-07-02T19:40:19 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 16384 bytes
   2015-07-02T19:40:19 INFO gdbserver/gdb-server.c: Chip ID is 00000413, Core ID is  2ba01477.
   2015-07-02T19:40:19 INFO gdbserver/gdb-server.c: Target voltage is 2903 mV.
   2015-07-02T19:40:19 INFO gdbserver/gdb-server.c: Listening at *:4242...
  1. arm交叉編譯工具
#!/bin/sh
    ST_LINK_PATH=/Users/xxx/Work/project/STM32F4/bin/stlink/bin
    ARM_GCC_PATH=/Users/xxx/Work/project/STM32F4/bin/gcc-arm-none-eabi-4_9-2015q2/bin
    export PATH=$PATH:$ST_LINK_PATH:$ARM_GCC_PATH

##基本測試工具

  1. 運行st-link
  2. 加載可執行程序,進行gdb調試:
    • arm-none-eabi-gdb main.elf
    • (gdb) tar ext :4242
    • (gdb) load
    • (gdb) b main ....以後就看你的了

最後留圖記念下: Reading symbols from main.elf...done. (gdb) tar ext :4242 Remote debugging using :4242 0x0800637c in ?? () (gdb) load Loading section .isr_vector, size 0x188 lma 0x8000000 Loading section .text, size 0x1b30 lma 0x8000188 Loading section .ARM, size 0x8 lma 0x8001cb8 Loading section .init_array, size 0x8 lma 0x8001cc0 Loading section .fini_array, size 0x4 lma 0x8001cc8 Loading section .data, size 0x46c lma 0x8001ccc Loading section .jcr, size 0x4 lma 0x8002138 Start address 0x8001c10, load size 8508 Transfer rate: 8 KB/sec, 1215 bytes/write. (gdb) l測試

相關文章
相關標籤/搜索