18175 views|12 replies

1903

Posts

0

Resources
The OP
 

Developing Keil MDK-ARM Projects with VisualGDB [Copy link]

 

I saw it on a foreign website, which is an idea of adding a compiler
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”:[ color=rgb(30, 115, 190)]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:[img =886,693]https://visualgdb.com/w/wp-content/uploads/2015/05/04-device.png[/img]
  • 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: [ font=inherit]
  • 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 (eg 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 com/w/wp-content/uploads/2015/05/empty.png[/img][/url]
  • 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:[font =inherit]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 (eg 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 com/w/wp-content/uploads/2015/05/empty.png[/img][/url]
  • 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:[font =inherit]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 (eg 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 //visualgdb.com/w/wp-content/uploads/2015/05/07-packs.png[/img][/url]For lower editions of VisualGDB, use the regular [b ]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 (eg 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 //visualgdb.com/w/wp-content/uploads/2015/05/07-packs.png[/img][/url]For lower editions of VisualGDB, use the regular [b ]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 (eg 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 png][/url] [* ]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:[url =https://visualgdb.com/w/wp-content/uploads/2015/05/10-build.png][/url]
  • Open the regular VS Project Properties. Note that the properties reflect the Keil-specific flags (eg allowing you to use scatter files instead of linker scripts):[/ font]
  • Open the Keil Components page of VisualGDB Project Properties again, pick your development board from the list and check the “LED” component:
  • Include the png][/url] [* ]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:[url =https://visualgdb.com/w/wp-content/uploads/2015/05/10-build.png][/url]
  • Open the regular VS Project Properties. Note that the properties reflect the Keil-specific flags (eg allowing you to use scatter files instead of linker scripts):[/ font]
  • Open the Keil Components page of VisualGDB Project Properties again, pick your development board from the list and check the “LED” component:
  • Include the file from your main file and add the following code to the end of main():
    1
    [color=rgb(49, 124, 197) !important]2[/font ]
    3
    [color=rgb(49, 124, 197) !important]4
    5
    [color=rgb(49, 124, 197) !important]6
    7
    [color=rgb( 49, 124, 197) !important]8
    [color=rgb(0, 0, 0) ][color=rgb(0, 78, 208) !important]LED_Initialize[color=rgb(51, 51, 51) !important][font =inherit]([color=rgb(51, 51, 51) !important])[color=rgb(51, 51, 51) !important]; [ font=inherit][color=rgb(128, 0, 128) !important]for[color=rgb(0, 111, 224) !important] [color=rgb(51, 51, 51) !important]([color=rgb(51, 51, 51) !important ];[color=rgb(51, 51, 51) !important];[color=rgb(51, 51, 51) !important]) [ font=inherit][color=rgb(51, 51, 51) !important]{ [color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]LED_On[color=rgb (51, 51, 51) !important]([color=rgb(206, 0, 0) !important]0[color=rgb(51, 51, 51) !important])[color=rgb( 51, 51, 51) !important]; [color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]HAL_Delay[color=rgb(51, 51, 51) !important ]([color=rgb(206, 0, 0) !important]100[color=rgb(51, 51, 51) !important])[color=rgb( 51, 51, 51) !important]; [color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]LED_Off[color=rgb(51, 51, 51) !important ]([color=rgb(206, 0, 0) !important]0[color=rgb(51, 51, 51) !important])[color=rgb( 51, 51, 51) !important]; [color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]HAL_Delay[color=rgb(51, 51, 51) !important]([color=rgb(206, 0, 0) !important]100[color=rgb(51 , 51, 51) !important])[color=rgb(51, 51, 51) !important]; [color=rgb(51, 51, 51) !important]}
    [ /td][/tr]
    Also add a basic SysTick_handler implementation:
    1
    [color=rgb(49, 124, 197) !important]2
    3
    [color= rgb(49, 124, 197) !important]4
    [color=rgb(128, 0, 128) !important]void[color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]SysTick_Handler[color=rgb(51 , 51, 51) !important]([color=rgb(128, 0, 128) !important]void [color=rgb(51, 51, 51) !important]) [color=rgb(51, 51, 51) !important ]{ [color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]HAL_IncTick[color =rgb(51, 51, 51) !important]([color=rgb(51, 51, 51) !important]) [color=rgb(51, 51, 51) !important]; [color=rgb(51, 51, 51) !important]}
  • 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:
"]
1
[color =rgb(49, 124, 197) !important]2
3
[ align=center][color=rgb(49, 124, 197) !important]4
[color =rgb(0, 0, 0)][color=rgb(128, 0, 128) !important]void[color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]SysTick_Handler[color=rgb (51, 51, 51) !important]([color=rgb(128, 0, 128) !important]void[/ color][color=rgb(51, 51, 51) !important]) [color=rgb(51, 51, 51) !important]{ [color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]HAL_IncTick[color=rgb(51, 51, 51) !important]([color=rgb(51, 51, 51) ! important])[color=rgb(51, 51, 51) !important]; [font =inherit][color=rgb(51, 51, 51) !important]}
[ *]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: [url =https://visualgdb.com/w/wp-content/uploads/2015/05/13-blink.png][/url]
  • 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: [img =1353,863]https://visualgdb.com/w/wp-content/uploads/2015/05/14-regs.png[/img] "]
    1
    [color =rgb(49, 124, 197) !important]2
    3
    [ align=center][color=rgb(49, 124, 197) !important]4
    [color =rgb(0, 0, 0)][color=rgb(128, 0, 128) !important]void[color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]SysTick_Handler[color=rgb (51, 51, 51) !important]([color=rgb(128, 0, 128) !important]void[/ color][color=rgb(51, 51, 51) !important]) [color=rgb(51, 51, 51) !important]{ [color=rgb(0, 111, 224) !important] [color=rgb(0, 78, 208) !important]HAL_IncTick[color=rgb(51, 51, 51) !important]([color=rgb(51, 51, 51) ! important])[color=rgb(51, 51, 51) !important]; [font =inherit][color=rgb(51, 51, 51) !important]}
    [ *]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: [url =https://visualgdb.com/w/wp-content/uploads/2015/05/13-blink.png][/url]
  • 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: [img =1353,863]https://visualgdb.com/w/wp-content/uploads/2015/05/14-regs.png[/img] important]{ [color=rgb(0, 111, 224) !important] [/ color][color=rgb(0, 78, 208) !important]HAL_IncTick[color=rgb(51, 51, 51) !important]( [color=rgb(51, 51, 51) !important])[color=rgb(51, 51, 51) !important] ; [color=rgb(51, 51, 51) !important]} [/td][/tr] [/table] [ *]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: [url =https://visualgdb.com/w/wp-content/uploads/2015/05/13-blink.png][/url]
  • 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: [img =1353,863]https://visualgdb.com/w/wp-content/uploads/2015/05/14-regs.png[/img] important]{ [color=rgb(0, 111, 224) !important] [/ color][color=rgb(0, 78, 208) !important]HAL_IncTick[color=rgb(51, 51, 51) !important]( [color=rgb(51, 51, 51) !important])[color=rgb(51, 51, 51) !important] ; [color=rgb(51, 51, 51) !important]} [/td][/tr] [/table] [ *]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: [url =https://visualgdb.com/w/wp-content/uploads/2015/05/13-blink.png][/url]
  • 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: [img =1353,863]https://visualgdb.com/w/wp-content/uploads/2015/05/14-regs.png[/img]
  • This post is from Embedded System

    Latest reply

    See the 11th floor and try my process. http://www.armbbs.cn/forum.php?mod=viewthread&tid=93539&page=1#pid161110   Details Published on 2020-2-5 09:25

    1w

    Posts

    25

    Resources
    2
     
    It's getting more complicated
    This post is from Embedded System
     
     

    172

    Posts

    0

    Resources
    3
     
    Thanks for sharing!
    This post is from Embedded System
     
     
     

    1903

    Posts

    0

    Resources
    4
     
    Yes
    This post is from Embedded System
     
     
     

    41

    Posts

    0

    Resources
    5
     
    Today I followed the steps and basically got through it. I can compile, download and debug.
    This post is from Embedded System
     
     
     

    1903

    Posts

    0

    Resources
    6
     
    Yeah, it's very simple.
    This post is from Embedded System

    Comments

    There are not many steps, but there are indeed several problems: the selection interface is blank, the jlink driver cannot be downloaded, and GDB is cracked.  Details Published on 2019-5-6 23:37
     
     
     

    41

    Posts

    0

    Resources
    7
     
    star_66666 posted on 2019-5-6 23:25 Yeah, it’s very simple
    There are not many steps, but I did encounter a few problems, such as the blank selection interface, the jlink driver could not be downloaded, and the GDB cracking.
    This post is from Embedded System
     
     
     

    1903

    Posts

    0

    Resources
    8
     
    Yes, there are definitely twists and turns.
    This post is from Embedded System
     
     
     

    1903

    Posts

    0

    Resources
    9
     
    You can also write another article, publish it, and share your process
    This post is from Embedded System
     
     
     

    935

    Posts

    1

    Resources
    10
     
    This post is from Embedded System
     
    Personal signature存储芯片/MCU/SRAM/PSRAM/DDR/FLASH/MRAM。web.www.sramsun.com  QQ3161422826 TEL:13751192923
     
     

    1903

    Posts

    0

    Resources
    11
     
    Thank you
    This post is from Embedded System
     
     
     

    1

    Posts

    0

    Resources
    12
     
    beatles posted on 2019-5-6 23:37 There are not many steps, but I did encounter a few problems, such as the blank selection interface, the inability to download the jlink driver, and the cracking of GDB.

    How do I solve the problem of no devices after I choose ARMCC or ARMCLANG?

    This post is from Embedded System
     
     
     

    41

    Posts

    0

    Resources
    13
     
    Run fast kid, hehe, posted on 2020-2-4 20:21 Boss, how do I solve the problem of no devices after I choose ARMCC or ARMCLANG?

    See the 11th floor and try my process. http://www.armbbs.cn/forum.php?mod=viewthread&tid=93539&page=1#pid161110

    This post is from Embedded System
     
     
     

    Just looking around
    Find a datasheet?

    EEWorld Datasheet Technical Support

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
    快速回复 返回顶部 Return list