Xubuntu openocd nRF51822 Download

Source: Internet
Author: User
Tags doxygen jlink

Recently worried about how to download nRF51822 and STM32F405RGT6 in the Xubuntu system, today finally downloaded successfully, recorded the process of resolution.

After entering the virtual box VM Bitcraze shared, go to the following directory:

Cd/home/bitcraze/projects/crazyflie2-nrf-firmware/

We will find the makefile file,

#Put your personal build config in config.mk and does not COMMIT it!-include config.mkcload_script? =. /crazyflie-clients-python/bin/cfloaders110 = 1 # softdevice flashed or notble? = 1 # BLE mode activated or not. If disabled, CRTP mode is activecross_compile?=arm-none-eabi-cc=$ (cross_compile) gccas=$ (cross_compile) asld=$ (CROSS_ COMPILE) Gccobjcopy = $ (cross_compile) Objcopysize = $ (cross_compile) sizegdb=$ (cross_compile) gdbopenocd? = Openocd Openocd_dir = Openocd_interface? = $ (openocd_dir) interface/stlink-v2.cfgopenocd_target? = target/nrf51_stlink.tc LNRF51_SDK = nrf51_sdk/nrf51822nrf_s110? = s110includes=-I include-i include/gcc-iinterfacepersonal_defines? = PROCES SOR =-mcpu=cortex-m0-mthumbnrf=-dnrf51program=cf2_nrfcflags=$ (PROCESSOR) $ (NRF) $ (personal_defines) $ (includes)-g3 -o0-wall#-fdata-sectionscflags+=-fsingle-precision-constant-ffast-math#--specs=nano.specs-fltoasflags=$ ( PROCESSOR) ldflags=$ (PROCESSOR)-o0--specs=nano.specs-wl,-map=$ (PROgram). map#-wl,--gc-sectionsifdef semihostingldflags+=--specs=rdimon.specs-lc-lrdimoncflags+=- Dsemihostingendififeq ($ (Strip $ (S110)), 1) ldflags +-t Gcc_nrf51_s110_xxaa.ldcflags + =-ds110=1elseldflags +-T GCC_NR F51_blank_xxaa.ldendififeq ($ (Strip $ (BLE)), 1) CFLAGS + =-dble=1objs + Src/ble/ble.oobjs + = Src/ble/ble_ Crazyflies.oobjs + = Src/ble/timeslot.oobjs + $ (nrf51_sdk)/source/ble/ble_advdata.oobjs + = $ (NRF51_SDK)/Source/ble/ BLE_CONN_PARAMS.OOBJS + = $ (NRF51_SDK)/source/ble/ble_services/ble_srv_common.oobjs + = $ (NRF51_SDK)/Source/ble/ble_ SERVICES/BLE_DIS.OOBJS + = $ (NRF51_SDK)/source/sd_common/softdevice_handler.oobjs + = $ (NRF51_SDK)/Source/app_common /app_timer.ocflags + =-dble_stack_support_reqd-dnrf51 CFLAGS +-i$ (NRF51_SDK)/include/gcc CFLAGS + =-i$ (NRF51_SDK)/ Include/cflags + =-i$ (nrf51_sdk)/include/ble/cflags + =-i$ (nrf51_sdk)/include/ble/ble_services/cflags + =-I$ (NRF_ S110)/s110_nrf51822_7.0.0_api/includecflags + =-i$ (nrf51_sdk)/include/app_common/cflags + =-I$ (NRF51_SDK)/include/sd_common/endifobjs + = src/main.o gcc_startup_nrf51.o system_nrf51.o src/uart.o src/syslink.o src /PM.O src/systick.o src/button.o src/swd.o src/ow.o src/ow/owlnk.o src/ow/ownet.o src/ow/owtran.o src/ow/c RCUTIL.O src/ds2431.o src/ds28e05.o src/esb.o src/memory.oall: $ (program), Elf $ (program), Bin $ (program). hex$ (SIZE) $ ( program). Elfifeq ($ ($ (strip $ (S110)), 1) @echo "S110 Activated" Else@echo "S110 Disabled" Endififeq ($ (Strip $ (BLE)), 1) @echo "Ble Activated" Else@echo "ble Disabled" endif$ (program). Hex: $ (program). elf$ (objcopy) $^-O ihex [email protected] $ (program). Bin: $ (program). elf$ (objcopy) $^-o binary [email protected]$ (program). Elf: $ (OBJS) $ (LD) $ (ldflags)-O [email protected] $^clean:rm-f $ (program). Bin $ (program). Elf $ (OBJS) # # Flash and debug Targetsflash: $ (program). hex$ (OPENOCD)-d2-f $ (Openocd_interface)-F $ (Openocd_target)-C init-c targets-c "Reset halt"-C "FLA SH write_image Erase $ (program). Hex "-C"Verify_image $ (program). Hex "-C" reset Run "-C shutdownflash_s110: $ (nrf_s110)/s110_nrf51822_7.0.0_softde  vice.hex$ (OPENOCD)-d2-f $ (Openocd_interface)-F $ (Openocd_target)-C init-c targets-c "Reset Halt"-C                  "nRF51 mass_erase"-C "flash Write_image erase S110/s110_nrf51822_7.0.0_softdevice.hex" -C "Reset Run"-C shutdownflash_mbs:bootloaders/nrf_mbs_v1.0.hex$ (OPENOCD)-d2-f $ (Openocd_interface)-F $ (OPENOCD_TAR GET)-C init-c targets-c "Reset halt"-C "flash Write_image erase $^"-C "Verify_image $^"-C "Reset ha LT "-C" MWW 0x4001e504 0x01 "-C" MWW 0x10001014 0x3f000 "-C" reset Run "-C Shutdownflash_clo  ad:bootloaders/cload_nrf_v1.0.hex$ (OPENOCD)-d2-f $ (Openocd_interface)-F $ (Openocd_target)-C init-c targets-c "reset Halt "-C" flash Write_image erase $^ "-C" Verify_image $^ "-C" Reset halt "-C" MWW 0x4001 e504 0x01 "-C" MWW 0x10001014 0x3f000 "-C" MWW 0x4001e504 0x01 "-C" MWW 0x10001080 0x3a000 "-C" reset Run "-C shutdownmass_erase:$ (O PENOCD)-d2-f $ (Openocd_interface)-F $ (Openocd_target)-C init-c targets-c "Reset halt"-C "nrf51 Mas  S_erase "-C shutdownreset:$ (OPENOCD)-d2-f $ (Openocd_interface)-F $ (Openocd_target)-C init-c targets-c Reset-c SHUTDOWNOPENOCD: $ (program). elf$ (OPENOCD)-d2-f $ (Openocd_interface)-F $ (Openocd_target)-C init-c Targetssem Ihosting: $ (program). elf$ (OPENOCD)-d2-f $ (Openocd_interface)-F $ (Openocd_target)-C init-c targets-c reset-c "arm SE Mihosting enable "-C Resetgdb: $ (program) elf$ (GDB)-ex" Target remote localhost:3333 "-EX" Monitor reset Halt "$^FLASH_JL Ink:jlinkexe-if swd-device NRF51822 flash.jlinkcload: $ (program). Binifeq ($ (Strip $ (S110)), 1) $ (cload_script) Flash $ (P Rogram). bin Nrf51-fwelse@echo "Only S110 build can is bootloaded. Launch build and Cload with S110=1 "Endiffactory_reset:make mass_eraseifeq ($ (striP $ (S110)), 1) make Flash_s110make flash_mbsmake flash_cloadendifmake Flash 

From the above file, we can see the typeface # # Flash and debug targets below is basically the command line that has a relationship with the download, normally, as long as the terminal

Make Flashmake flash_s110make flash_mbsmake flash_cload

You can download the corresponding program to nRF51822, but make Flash will have the following error:

[email protected]:~/projects/crazyflie2-nrf-firmware$ make Mass_eraseopenocd-d2-f interface/stlink-v2.cfg-f Target/nrf51_stlink.tcl-c init-c targets-c "Reset halt"-C "nrf51 mass_erase"-C Shutdownopen on-chip Debugger 0.8.0 (2014-05-10-23:21) Licensed under GNU GPL v2for bug reports, readhttp://openocd.sourceforge.net/doc/  Doxygen/bugs.htmldebug_level:2info:this Adapter doesn ' t support configurable Speedinfo:stlink v2 JTAG v16 API v2 SWIM V0 VID 0x0483 PID 0x3748info:using stlink API V2info:target Voltage:2.559498info:nrf51.cpu:hardware has 4 Breakpo INTs, 2 watchpoints TargetName Type Endian tapname State---------------------------- --------------------------------------0* nrf51.cpu hla_target Little nrf51.cpu runningtarget State: Haltedtarget halted due to debug-request, current Mode:thread xpsr:0xc1000000 pc:0x000006d0 msp:0x000007c0warn:unkno WN device (Hwid 0x00000058)

finally always hint Warn:unknown device (hwid 0x00000058), very strange, online various search, finally still feel certainly not hardware connection no problem, or OPENOCD no thoroughly understand led to identify errors. using makefile cannot walk through, we know that OPENOCD itself is a command to try to do debug tools, so we can take the makefile in the command line apart, to see where there is a problem. First open a terminal, type openocd-d2-f interface/stlink-v2.cfg-f target/nrf51_stlink.tcl:

[Email protected]:~/projects/crazyflie2-nrf-firmware$ openocd-d2-f interface/stlink-v2.cfg-f target/nrf51_ Stlink.tclopen on-chip Debugger 0.8.0 (2014-05-10-23:21) Licensed under GNU GPL v2for bug reports, Readhttp://openocd.sour  Ceforge.net/doc/doxygen/bugs.htmldebug_level:2info:this Adapter doesn ' t support configurable Speedinfo:stlink v2 JTAG V16 API v2 SWIM v0 VID 0x0483 PID 0x3748info:using stlink API V2info:target Voltage:2.556986info:nrf51.cpu:hardwa Re has 4 breakpoints, 2 watchpoints

Then open another terminal, type telnet localhost 4444:

Then continue typing reset and halt

> reset> halttarget state:haltedtarget halted due to debug-request, current Mode:handler hardfaultxpsr:0xc1000003 Pc:0xfffffffe Msp:0xffffffd8

Below we should erase the nRF51822 inside the program, download the new program:

> nRF51 mass_erase

Sometimes there is still a hint of unknown device (Hwid 0x00000058), but try entering nrf51 Mass_erase again may not have this problem, then you can start to download mbs,cload, S110 and Firmwire program, here we have to download separately, St-link speed ultra-slow.

> Flash write_image erase bootloaders/nrf_mbs_v1.0.hexauto erase enabledwrote 3072 bytes from file bootloaders/nrf_mbs _v1.0.hex in 19.444714s (0.154 kib/s) > Flash write_image Erase Bootloaders/cload_nrf_v1.0.hex         

From the above view, all the programs have been downloaded OK. In addition, from the last part of Makefile can be seen to support Jlink download, this part will try to

Flash_jlink:jlinkexe-if Swd-device NRF51822 Flash.jlink

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Xubuntu openocd nRF51822 Download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.