2

(我在我的问题中添加了链接,但我会尽可能详细地解释我的问题是什么,这样您就不需要使用这些链接,它们仅供参考)您好,

我正在尝试遵循此 youtube 教程(https://www.youtube.com/watch?v=R6SstBoXjKc&list=PL6PplMTH29SHgRPDufZhfMRoFwRAIrzOp),但他使用 coocox IDE 和 windows。我正在使用 VS Code 和 Ubuntu 16.04.4 LTS。我正在尝试使用 VS Code 的 platformio 扩展以及 stlink-v2 和裸 stm32 f030r8t6 微控制器(https://www.newbiehack.com/categories/newbiehack-microcontroller-ARM-stmicro-STM32F0R6-withBreadboardInterface)。要将我的笔记本电脑连接到开发板,我使用了 st-util 命令,该命令提供以下输出:

    st-util 1.4.0-40-g1ec89bf
2018-07-12T21:28:36 INFO common.c: Loading device parameters....
2018-07-12T21:28:36 WARN common.c: Invalid flash type, please check device declaration
2018-07-12T21:28:36 INFO gdb-server.c: Chip ID is 00000000, Core ID is  00000000.
2018-07-12T21:28:36 INFO gdb-server.c: Listening at *:4242...

我的 platform.ini 文件是:

[env:f030r8t6]
platform = ststm32
board = f030r8t6
framework = stm32cube

我创建了一个名为 f030r8t6.json 的自定义配置文件:

{
  "build": {
    "cpu": "cortex-m0",
    "extra_flags": "-DSTM32F030x8",
    "f_cpu": "48000000L",
    "mcu": "stm32f030r8t6"
  },
  "debug": {
    "default_tools": [
      "stlink"
    ],
    "openocd_target": "stm32f0x",
    "svd_path": "STM32F030.svd"
  },
  "frameworks": [
    "mbed",
    "stm32cube"
  ],
  "name": "ST STM32F030r8t6",
  "upload": {
    "maximum_ram_size": 8192,
    "maximum_size": 65536,
    "protocol": "stlink",
    "protocols": [
      "jlink",
      "stlink",
      "blackmagic"
    ]
  },
  "url": "http://www.st.com/en/evaluation-tools/32f0308discovery.html",
  "vendor": "ST"
}

当我构建项目时,一切正常,但是当我尝试上传时,我得到以下信息:

Processing f030r8t6 (platform: ststm32; board: f030r8t6; framework: stm32cube)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST STM32F030r8t6
SYSTEM: STM32F030R8T6 48MHz 8KB RAM (64KB Flash)
DEBUG: CURRENT(stlink) EXTERNAL(blackmagic, jlink, stlink)
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Checking size .pioenvs/f030r8t6/firmware.elf
DATA:    [          ]   0.3% (used 28 bytes from 8192 bytes)
PROGRAM: [          ]   0.7% (used 484 bytes from 65536 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, jlink, stlink
CURRENT: upload_protocol = stlink
Uploading .pioenvs/f030r8t6/firmware.elf
GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00392-gbe9ef0b0 (2018-01-12-14:56)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked

*** [upload] Error 1
=================================================================== [ERROR] Took 0.84 seconds ===================================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

我已经坚持了好几个星期了,非常感谢任何帮助!谢谢!

4

1 回答 1

0

我猜你在 gpio 主重映射时关闭了代码中的 JTAG 和 SW。当我使用 libOpenCM3 框架编写 stm32 时,像这样的代码: gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_OFF, AFIO_MAPR_CAN1_REMAP_PORTB); 会导致像你这样的问题。

于 2018-07-19T10:39:15.143 回答