请选择 进入手机版 | 继续访问电脑版
搜索
热搜: ROHM 模拟 车载
查看: 1182|回复: 6

Developing Keil MDK-ARM Projects with VisualGDB

  [复制链接]

该用户从未签到

204

主题

1万

帖子

0

精华

论坛元老

最后登录
2022-1-21
发表于 2019-5-17 00:19:57 | 显示全部楼层 |阅读模式
在一个外文网站看到的,算是增加一个编译器的思路吧


This tutorial shows how to use VisualGDB to create, build and debug an MSBuild-based project using the Keil MDK-ARM compiler.
Starting from VisualGDB 5.4 Preview 10, the Keil compiler is fully supported on par with the GCC compiler, so you can use the regular VisualGDB GUI to create your projects and manage their settings.
  • Open Visual Studio and begin creating a new Embedded VisualGDB project:
  • Select “Create a new project” -> “MSBuild”:VisualGDB can also create GNU Make-based projects using the Keil compiler, however the MSBuild-based projects provide better GUI integration and build faster.
  • Select your Keil toolchain on the Device Selection page. Note that VisualGDB supports both the classic ARMCC compiler (V5) and the newer Clang-based compiler (V6):
    If the Keil compilers don’t appear in the toolchain list, double-check the Keil installation path in registry (HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Keil\Products\MDK\Path).
  • Once the toolchain is selected, pick your
  • device from the list. When using the Keil toolchains, VisualGDB will automatically load device lists from the Keil packs, so you will be able to target any device supported by the Keil environment even if it’s not directly supported by VisualGDB:
  • Projects created using the Keil toolchain always start empty, so simply press “Next” on the Sample Selection page:
  • Finally select the debug method for your device and press “Finish” to create the project:
  • VisualGDB will create an empty project with no source files that will target the selected device:
  • If you are using the Custom edition of VisualGDB or higher, right-click on the project in Solution Explorer, click “VisualGDB Project Properties” and go to the “Keil Components” page. Ensure that the “Automatically manage RTE_Components” flag is set:For lower editions of VisualGDB, use the regular Add->Existing Item menu to manually adds sources and headers to the project.
  • Check the “Device->Startup” and “Device->STM32Cube HAL->GPIO” components. VisualGDB will automatically detect their dependencies and suggest adding them as well:
  • Click “OK” to proceed. VisualGDB will show a list of file templates offered by the selected components. Check the “main module for STM32Cube HAL” template and click “OK”:
  • VisualGDB will automatically add files from the selected components (including a copy of the main.c file) to your project, allowing you to build it:
  • Open the regular VS Project Properties. Note that the properties reflect the Keil-specific flags (e.g. allowing you to use scatter files instead of linker scripts):
  • Open the Keil Components page of VisualGDB Project Properties again, pick your development board from the list and check the “LED” component:
  • Include the <Board_LED.h> file from your main file and add the following code to the end of main():

    1
    2
    3
    4
    5
    6
    7
    8

    LED_Initialize();
    for (;;)
    {
        LED_On(0);
        HAL_Delay(100);
        LED_Off(0);
        HAL_Delay(100);
    }




    Also add a basic SysTick_handler implementation:

    1
    2
    3
    4

    void SysTick_Handler(void)
    {
        HAL_IncTick();
    }

  • Press F5 to begin debugging. Once the on-board LED starts blinking, set a breakpoint in the main loop and wait for it to trigger:
  • Note that VisualGDB will automatically load the memory layout and the hardware register definitions from the Keil packs, so you won’t need to specify them manually:


回复

使用道具 举报

该用户从未签到

49

主题

2251

帖子

0

精华

论坛元老

最后登录
2020-12-15
发表于 2019-5-17 14:08:52 | 显示全部楼层
感谢分享               
QQ图片20190122083818.png
回复 支持 反对

使用道具 举报

该用户从未签到

204

主题

1万

帖子

0

精华

论坛元老

最后登录
2022-1-21
 楼主| 发表于 2019-5-18 00:06:12 | 显示全部楼层
哈哈 logo.png
回复 支持 反对

使用道具 举报

该用户从未签到

204

主题

1万

帖子

0

精华

论坛元老

最后登录
2022-1-21
 楼主| 发表于 2019-5-18 00:06:44 | 显示全部楼层
客气 logo.png
回复 支持 反对

使用道具 举报

该用户从未签到

204

主题

1万

帖子

0

精华

论坛元老

最后登录
2022-1-21
 楼主| 发表于 2019-5-18 00:07:48 | 显示全部楼层
加油 logo.png
回复 支持 反对

使用道具 举报

该用户从未签到

204

主题

1万

帖子

0

精华

论坛元老

最后登录
2022-1-21
 楼主| 发表于 2019-5-18 00:09:15 | 显示全部楼层
哦哦 logo.png
回复 支持 反对

使用道具 举报

该用户从未签到

204

主题

1万

帖子

0

精华

论坛元老

最后登录
2022-1-21
 楼主| 发表于 2019-5-18 00:09:35 | 显示全部楼层
呵呵
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /2 下一条

Archiver|手机版|小黑屋|罗姆半导体技术社区

GMT+8, 2022-1-21 14:08 , Processed in 0.074815 second(s), 19 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表