CRAZYFLIE2_NRF51822 Program Analysis--general structure

Source: Internet
Author: User

In order to respect the original version, the English text is pasted out, while the need to note some of the places to add my comments

Source Code of the firmware running in the Crazyflie 2.0 nRF51822. This microcontroller has a couple of roles:

    • Power management (on/off logic and battery handling), power management, on/off Stm32
    • Radio Communication Wireless Communication
      • Enhanced Shockburst compatible with Crazyradio (PA)---ESB
      • Bluetooth low energy using the Nordic Semiconductor S110 stack---ble is bluetooth
    • One-wire memory Access supports both first-line memory accesses, and the US official sees a memory chip similar to the DS18B20 bus, where the expansion board will use

Compiling with Bluetooth support requires the NRF51_SDK and S110 packages.

NRF51_SDK and Bluetooth protocol package s110, so you need to download the following SH file

    ./tools/build/download_deps.sh

Would download the Zips and unpack them. If you want to download manually from the Nordic semiconductor website, you'll find the details in Nrf51_sdk/readme and S110/readme.

Compiling

To compile arm-none-eabi-tools from https://launchpad.net/gcc-arm-embedded should is in the path.

Compilation options can be saved in config.mk. Main Targets:

Download can be used make factory_reset, directly will be the MBS, bootloader,s110 and firmware all to download in

make                 # Make with BLE supportmake BLE=0           # Make without BLE supportmake BLE=0 S110=0    # Make without BLE and without Softdevice in flash (see bellow)make flash           # Flash firmware with jtagmake factory_reset   # Erase device and flash softdevice, bootloaders, and firmware
Architecture

The following is the focus, 256K flash,crazyflie2 unexpectedly divided into so many pieces, good tired!

When running without Softdevice (s110=0) The firmware are loaded at the beginning of the flash and are running alone in the Cpu.

When running with Softdevive (s110=1) independent of if BLE are activated or not, the flash is filled as follow:

+--------------+ 256k|    MBS |  Write protected+--------------+ 252k|              Bootloader |+--------------+ 232k|              ||              ||              ||              ||  ||              Firmware |+--------------+ 88k|              ||              ||              ||              ||              ||  ||     Softdevice |+--------------+ 4k|    MBR | Write protected+--------------+ 0  
    • MBR  Softdevice Master Boot Record. Don't worry about it.
    • Softdevice S110 Bluetooth Stack This code can not see, with the official hex file on it, and s120,s130 and so on
    • Firmware This firmware the program used during the flight
    • Bootloader Bluetooth/shockburst bootloader Download firmware used firmware program, by long Press the button can enter bootloader
    • MBS Master Boot Switch This should be able to update bootloader

Boot sequence: (Fortunately there is the order of the program to go after the power, otherwise it will be blindfolded)

 MBR ----> MBS ----> Bootloader ----> Firmware

The MBR is part of the Softdevice. It Boots the CPU and jump to MBS. The MBR contains methods to start the Softdevice and can flash Softdevice and bootloader.

The MBS handles the on/off button and comunicate the duration of the press to the bootloader so, the bootloader knows What to boot. The reason for the MBS are to allow updating the bootloader over the air while still have a write-protected piece of soft Ware that can start the STM32 in USB DFU mode for recovery (the STM32 have access to the NRF51 SWD programming port). The boot switch is as follow:

Press and hold the time of the different will enter a different program, while you can observe the blue led, note is nrf51822 side of the LED, not STM32

Press Time State Program
Blue LEDbooted
Short Still Firmware
Long (>3s) Slow Blink Bootloader
Very Long (>5s) Fast Blink Stays in MBS and power STM32 in USB DFU mode

The bootloader, if selected, starts the STM32 in bootloader mode and initialize both BLE and Shockburst (ESB) radio. It can flash everything but MBR and MBS. It also acts as a bridge to the STM32 bootloader.

If not selected, the bootloader jumps to the firmware.


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

CRAZYFLIE2_NRF51822 Program Analysis--general structure

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.