How to setup MDK-ARM project to flash/debug mbed SDK test code

This is quick instruction how to setup/configure Keil MDK-ARM project file flash and debug mbed SDK test code.

Create a project

  • Launch MDK-ARM
  • Create new project form menu [Project] - [New uVision Project...] with any project name
    Note: I recommend not to create a project in mbed GitHub local directly to avoid sync problem
    /media/uploads/MACRUM/create_project.jpg
  • Select your target device. e.g. [NXP] - [LPC1114/102]
    /media/uploads/MACRUM/select_device.jpg
  • Do not copy startup code (press 'NO' in the dialog below)
    /media/uploads/MACRUM/startup_code.jpg

Configure settings

  • Open project setting from menu [Project] - [Options for Target 'Target 1'...]
  • Click 'Output' tab
  • Press 'Select Folder for Objects...' button and select your ELF file of mbed test case.
    e.g. C:\Users\toywat01\Documents\GitHub_mbed\build\test\LPC1114\ARM\MBED_11
  • Changed ELF file name in 'Name of Executable:' text field.
    e.g. ticker.elf
    /media/uploads/MACRUM/load_elf.jpg
  • Click 'Debug' tab
  • Select your debug adapter on the right hand side of the setting panel
    e.g. Press 'Use:' radio button and select 'ULINK2/ME Cortex Debugger'
    /media/uploads/MACRUM/debug.jpg
  • Press 'Settings' button
  • Check 'Download to Flash'
    /media/uploads/MACRUM/debug_setting.jpg
  • Press 'OK' to close the dialog
  • Press 'Utilities' tab
  • Uncheck 'Use Debug Driver'
    /media/uploads/MACRUM/utilities_no_driver.jpg
  • Press 'Settings' button
  • Check 'Reset and Run'
    /media/uploads/MACRUM/flash.jpg
  • Press 'OK' to closed the dialog

Flash your test code

  • Download and flash your test code from menu [Flash] - [Download]
  • You will see a result of flash programming in build output window
    /media/uploads/MACRUM/flash_log.jpg

Debug your test code

  • Start debug session from menu [Debug] - [Start/Stop Debug Session]
    /media/uploads/MACRUM/debug_session.jpg
  • From command window, enter "bs main" to set breakpoint at main() function.
  • Press 'Run' button in toolbar and your test code stops at main() function.
  • You can open peripheral register windows from menu [Peripherals], if your target has CMSIS-SVD file. This is very useful feature for mbed SDK debugging.
    /media/uploads/MACRUM/peripherals.jpg


Please log in to post comments.