发 帖  
张飞软硬开源基于STM32 BLDC直流无刷电机驱动器开发视频套件, 👉戳此立抢👈

[经验] Developing Keil MDK-ARM Projects with VisualGDB

2019-5-5 18:01:16  424 嵌入式 labview STM32 ARM
分享
2

在一个外文网站看到的,算是增加一个编译器的思路吧


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:



王栋春 2019-5-5 21:31:06
哎 英语水平太陋了  围观期待高手
回复

举报

lee_st 2019-5-6 09:24:03
老王卖瓜哦
回复

举报

评论

高级模式
您需要登录后才可以回帖 登录 | 注册

发经验
课程
    关闭

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

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