Skip to content

Commit

Permalink
Merge pull request #4 from bitcraze/master
Browse files Browse the repository at this point in the history
업데이트
  • Loading branch information
chcbaram committed Dec 1, 2015
2 parents 55a0360 + 6630b3a commit 28b6f16
Show file tree
Hide file tree
Showing 142 changed files with 14,659 additions and 5,437 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
build_info.json

^bin/dep/all
bin/*
.cproject
.project
.settings/*
*~
config.mk
tools/make/config.mk
cflie.*
version.c

/cf2.*
/cf1.*
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
sudo: required
language: c
services:
- docker
before_install:
- docker pull bitcraze/builder
script:
# Build CF2 basic
- docker run --rm -v ${PWD}:/module bitcraze/builder ./tools/build/build PLATFORM=CF2

# Build CF2 with "all" features enabled
- docker run --rm -v ${PWD}:/module bitcraze/builder ./tools/build/build clean
- docker run --rm -v ${PWD}:/module bitcraze/builder ./tools/build/build PLATFORM=CF2 DEBUG=1 "EXTRA_CFLAGS=-DCALIBRATED_LED_MORSE -DIMU_TAKE_ACCEL_BIAS -DIMU_MPU6500_DLPF_256HZ -DMADWICK_QUATERNION_IMU -DDEBUG_QUEUE_MONITOR"

# Build CF1
- docker run --rm -v ${PWD}:/module bitcraze/builder ./tools/build/build clean
- docker run --rm -v ${PWD}:/module bitcraze/builder ./tools/build/build PLATFORM=CF1

# Build CF1 with "all" features enabled
- docker run --rm -v ${PWD}:/module bitcraze/builder ./tools/build/build clean
- docker run --rm -v ${PWD}:/module bitcraze/builder ./tools/build/build PLATFORM=CF1 DEBUG=1
70 changes: 41 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
# This Makefile compiles all the objet file to ./bin/ and the resulting firmware
# image in ./cfX.elf and ./cfX.bin

#Put your personal build config in config.mk and DO NOT COMMIT IT!
-include config.mk
# Put your personal build config in tools/make/config.mk and DO NOT COMMIT IT!
# Make a copy of tools/make/config.mk.example to get you started
-include tools/make/config.mk

CFLAGS += $(EXTRA_CFLAGS)

######### JTAG and environment configuration ##########
OPENOCD ?= openocd
Expand All @@ -26,9 +29,6 @@ OPENOCD_TARGET ?= target/stm32f4x_stlink.cfg
USE_FPU ?= 1
endif

## Flag that can be added to config.mk
# CFLAGS += -DUSE_ESKYLINK # Set CRTP link to E-SKY receiver
# CFLAGS += -DDEBUG_PRINT_ON_UART # Redirect the console output to the UART

ifeq ($(PLATFORM), CF1)
REV ?= F
Expand All @@ -52,12 +52,12 @@ PORT = $(FREERTOS)/portable/GCC/ARM_CM3
endif

ifeq ($(PLATFORM), CF1)
LINKER_DIR = scripts/F103/linker
ST_OBJ_DIR = scripts/F103
LINKER_DIR = tools/make/F103/linker
ST_OBJ_DIR = tools/make/F103
endif
ifeq ($(PLATFORM), CF2)
LINKER_DIR = scripts/F405/linker
ST_OBJ_DIR = scripts/F405
LINKER_DIR = tools/make/F405/linker
ST_OBJ_DIR = tools/make/F405
endif

STLIB = lib
Expand All @@ -75,7 +75,7 @@ VPATH_CF2 += $(STLIB)/STM32_CPAL_Driver/src
VPATH_CF2 += $(STLIB)/STM32_USB_Device_Library/Core/src
VPATH_CF2 += $(STLIB)/STM32_USB_OTG_Driver/src
VPATH_CF2 += $(STLIB)/STM32_CPAL_Driver/devices/stm32f4xx
VPATH_CF2 += deck/api
VPATH_CF2 += deck/api deck/core deck/drivers/src
CRT0_CF2 = startup_stm32f40xx.o system_stm32f4xx.o

# Should maybe be in separate file?
Expand Down Expand Up @@ -115,38 +115,49 @@ endif
############### Source files configuration ################

# Init
PROJ_OBJ = main.o
PROJ_OBJ_CF1 = platform_cf1.o
PROJ_OBJ_CF2 = platform_cf2.o
PROJ_OBJ += main.o
PROJ_OBJ_CF1 += platform_cf1.o
PROJ_OBJ_CF2 += platform_cf2.o

# Drivers
PROJ_OBJ += exti.o nvic.o motors.o
PROJ_OBJ_CF1 += led_f103.o i2cdev_f103.o i2croutines.o adc_f103.o mpu6050.o hmc5883l.o ms5611.o nrf24l01.o eeprom.o
PROJ_OBJ_CF2 += led_f405.o mpu6500.o i2cdev_f405.o ws2812.o lps25h.o ak8963.o eeprom.o maxsonar.o
PROJ_OBJ_CF2 += uart_syslink.o swd.o uart1.o uart2.o
PROJ_OBJ_CF1 += led_f103.o i2cdev_f103.o i2croutines.o adc_f103.o mpu6050.o
PROJ_OBJ_CF1 += hmc5883l.o ms5611.o nrf24l01.o eeprom.o watchdog.o
PROJ_OBJ_CF2 += led_f405.o mpu6500.o i2cdev_f405.o ws2812_cf2.o lps25h.o
PROJ_OBJ_CF2 += ak8963.o eeprom.o maxsonar.o piezo.o
PROJ_OBJ_CF2 += uart_syslink.o swd.o uart1.o uart2.o watchdog.o
# USB Files
PROJ_OBJ_CF2 += usb_bsp.o usblink.o usbd_desc.o usb.o

# Hal
PROJ_OBJ += crtp.o ledseq.o freeRTOSdebug.o
PROJ_OBJ += crtp.o ledseq.o freeRTOSdebug.o buzzer.o
PROJ_OBJ_CF1 += imu_cf1.o pm_f103.o nrf24link.o ow_none.o uart.o
PROJ_OBJ_CF2 += imu_cf2.o pm_f405.o syslink.o radiolink.o ow_syslink.o proximity.o

# Modules
PROJ_OBJ += system.o comm.o console.o pid.o crtpservice.o param.o mem.o
PROJ_OBJ += commander.o controller.o sensfusion6.o stabilizer.o
PROJ_OBJ += log.o worker.o trigger.o sitaw.o
PROJ_OBJ_CF2 += neopixelring.o expbrd.o platformservice.o bigquad.o
PROJ_OBJ += log.o worker.o trigger.o sitaw.o queuemonitor.o
PROJ_OBJ_CF1 += sound_cf1.o
PROJ_OBJ_CF2 += platformservice.o sound_cf2.o

# Expansion boards
PROJ_OBJ_CF2 += exptest.o
# Deck Core
PROJ_OBJ_CF2 += deck.o deck_info.o deck_drivers.o

# Deck API
PROJ_OBJ_CF2 += deck_constants.o
PROJ_OBJ_CF2 += deck_digital.o
PROJ_OBJ_CF2 += deck_analog.o
PROJ_OBJ_CF2 += buzzdeck.o

# Decks
PROJ_OBJ_CF2 += bigquad.o
PROJ_OBJ_CF2 += exptest.o
PROJ_OBJ_CF2 += ledring12.o

# Utilities
PROJ_OBJ += filter.o cpuid.o cfassert.o eprintf.o crc.o fp16.o debug.o
PROJ_OBJ += version.o
PROJ_OBJ += version.o FreeRTOS-openocd.o
PROJ_OBJ_CF1 += configblockflash.o
PROJ_OBJ_CF2 += configblockeeprom.o

Expand Down Expand Up @@ -185,7 +196,7 @@ INCLUDES_CF2 += -I$(STLIB)/STM32_CPAL_Driver/inc
INCLUDES_CF2 += -I$(STLIB)/STM32_CPAL_Driver/devices/stm32f4xx
INCLUDES_CF2 += -I$(STLIB)/STM32_USB_Device_Library/Core/inc
INCLUDES_CF2 += -I$(STLIB)/STM32_USB_OTG_Driver/inc
INCLUDES_CF2 += -Ideck/interface
INCLUDES_CF2 += -Ideck/interface -I deck/drivers/interface

ifeq ($(USE_FPU), 1)
PROCESSOR = -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16
Expand Down Expand Up @@ -234,7 +245,7 @@ CFLAGS += -MD -MP -MF $(BIN)/dep/$(@).d -MQ $(@)
CFLAGS += -ffunction-sections -fdata-sections

ASFLAGS = $(PROCESSOR) $(INCLUDES)
LDFLAGS = --specs=nano.specs $(PROCESSOR) -Wl,-Map=$(PROG).map,--cref,--gc-sections
LDFLAGS = --specs=nano.specs $(PROCESSOR) -Wl,-Map=$(PROG).map,--cref,--gc-sections,--undefined=uxTopUsedPriority

#Flags required by the ST library
ifeq ($(CLOAD), 1)
Expand Down Expand Up @@ -283,15 +294,13 @@ ifeq ($(SHELL),/bin/sh)
endif

print_version: compile
ifeq ($(SHELL),/bin/sh)
@./scripts/print_revision.sh
endif
ifeq ($(PLATFORM), CF1)
@echo "Crazyflie Nano (1.0) build!"
endif
ifeq ($(PLATFORM), CF2)
@echo "Crazyflie 2.0 build!"
endif
@$(PYTHON2) tools/make/versionTemplate.py --print-version
ifeq ($(CLOAD), 1)
@echo "Crazyloader build!"
endif
Expand Down Expand Up @@ -324,13 +333,16 @@ reset:
$(OPENOCD) -d0 -f $(OPENOCD_INTERFACE) -f $(OPENOCD_TARGET) -c init -c targets -c "reset" -c shutdown

openocd:
$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) -f $(OPENOCD_TARGET) -c init -c targets
$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) -f $(OPENOCD_TARGET) -c init -c targets -c "\$$_TARGETNAME configure -rtos auto"

trace:
$(OPENOCD) -d2 -f $(OPENOCD_INTERFACE) -f $(OPENOCD_TARGET) -c init -c targets -f tools/trace/enable_trace.cfg

#Print preprocessor #defines
prep:
@$(CC) -dD

include scripts/targets.mk
include tools/make/targets.mk

#include dependencies
-include $(DEPS)
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Crazyflie 1.0/2.0 Firmware
# Crazyflie 1.0/2.0 Firmware [![Build Status](https://api.travis-ci.org/bitcraze/crazyflie-firmware.svg)](https://travis-ci.org/bitcraze/crazyflie-firmware)

This project contains the source code for the Crazyflie 1.0/2.0 firmware.

Expand All @@ -7,8 +7,10 @@ This project contains the source code for the Crazyflie 1.0/2.0 firmware.
You'll need to use either the Crazyflie VM or install some of an ARM toolchain.

### OS X

> `TODO: Please share!`
```bash
brew tap PX4/homebrew-px4
brew install gcc-arm-none-eabi
```

### Debian/Ubuntu

Expand Down Expand Up @@ -66,7 +68,7 @@ More information can be found on the
| + src | Utils source code
| + interface | Utils header files. Interface with the other parts of the program
+ platform | Platform specific files. Not really used yet
+ scripts | Misc. scripts for LD, OpenOCD, make, version control, ...
+ tools | Misc. scripts for LD, OpenOCD, make, version control, ...
| | *** The two following folders contains the unmodified files ***
+ lib | Libraries
| + FreeRTOS | Source FreeRTOS folder. Cleaned up from the useless files
Expand Down
17 changes: 15 additions & 2 deletions config/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

#include <stdint.h>

#include "config.h"
#include "cfassert.h"
/*-----------------------------------------------------------
Expand All @@ -76,7 +78,6 @@
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) FREERTOS_MIN_STACK_SIZE )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( FREERTOS_HEAP_SIZE ) )
#define configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_CO_ROUTINES 0
Expand All @@ -87,7 +88,7 @@
#define configUSE_MALLOC_FAILED_HOOK 1
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE

#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
#define configMAX_PRIORITIES ( 6 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Set the following definitions to 1 to include the API function, or zero
Expand Down Expand Up @@ -129,11 +130,23 @@ to exclude the API function. */
#define TASK_PROXIMITY_ID_NBR 6

#define configASSERT( x ) if( ( x ) == 0 ) assertFail(#x, __FILE__, __LINE__ )

/*
#define traceTASK_SWITCHED_IN() \
{ \
extern void debugSendTraceInfo(unsigned int taskNbr); \
debugSendTraceInfo((int)pxCurrentTCB->pxTaskTag); \
}
*/

// Queue monitoring
#ifdef DEBUG_QUEUE_MONITOR
#undef traceQUEUE_SEND
#undef traceQUEUE_SEND_FAILED
#define traceQUEUE_SEND(xQueue) qm_traceQUEUE_SEND(xQueue)
void qm_traceQUEUE_SEND(void* xQueue);
#define traceQUEUE_SEND_FAILED(xQueue) qm_traceQUEUE_SEND_FAILED(xQueue)
void qm_traceQUEUE_SEND_FAILED(void* xQueue);
#endif // DEBUG_QUEUE_MONITOR

#endif /* FREERTOS_CONFIG_H */
49 changes: 35 additions & 14 deletions config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#define CONFIG_H_
#include "nrf24l01.h"

#include "trace.h"

#define PROTOCOL_VERSION 2

#ifdef STM32F4XX
Expand All @@ -52,7 +54,7 @@
#define CONFIG_BLOCK_ADDRESS (2048 * (64-1))
#define MCU_ID_ADDRESS 0x1FFF7A10
#define MCU_FLASH_SIZE_ADDRESS 0x1FFF7A22
#define FREERTOS_HEAP_SIZE 20000
#define FREERTOS_HEAP_SIZE 22000
#define FREERTOS_MIN_STACK_SIZE 150 // M4-FPU register setup is bigger so stack needs to be bigger
#define FREERTOS_MCU_CLOCK_HZ 168000000

Expand All @@ -67,25 +69,37 @@
#endif


//Task priorities. Higher number higher priority
// Task priorities. Higher number higher priority
#define STABILIZER_TASK_PRI 4
#define ADC_TASK_PRI 3
#define SYSTEM_TASK_PRI 2
#define CRTP_RXTX_TASK_PRI 2
#define CRTP_TX_TASK_PRI 2
#define CRTP_RX_TASK_PRI 2
#define LOG_TASK_PRI 1
#define MEM_TASK_PRI 1
#define PARAM_TASK_PRI 1
#define STABILIZER_TASK_PRI 4
#define SYSLINK_TASK_PRI 3
#define USBLINK_TASK_PRI 3
#define PROXIMITY_TASK_PRI 0
//CF1
#define ADC_TASK_PRI 0
#define PM_TASK_PRI 0
#define NRF24LINK_TASK_PRI 2
#define ESKYLINK_TASK_PRI 1
#define CRTP_TX_TASK_PRI 2
#define CRTP_RX_TASK_PRI 2

//Task names
#ifdef PLATFORM_CF2
#define SYSLINK_TASK_PRI 5
#define USBLINK_TASK_PRI 3
#endif

#ifdef PLATFORM_CF1
#define NRF24LINK_TASK_PRI 2
#define ESKYLINK_TASK_PRI 1
#define UART_RX_TASK_PRI 2
#endif

// Not compiled
#if 0
#define INFO_TASK_PRI 2
#define PID_CTRL_TASK_PRI 2
#endif


// Task names
#define SYSTEM_TASK_NAME "SYSTEM"
#define ADC_TASK_NAME "ADC"
#define PM_TASK_NAME "PWRMGNT"
Expand All @@ -101,7 +115,11 @@
#define SYSLINK_TASK_NAME "SYSLINK"
#define USBLINK_TASK_NAME "USBLINK"
#define PROXIMITY_TASK_NAME "PROXIMITY"
//Task stack sizes
#define UART_RX_TASK_NAME "UART-RX"
#define INFO_TASK_NAME "INFO"
#define PID_CTRL_TASK_NAME "PID-CTRL"

// Task stack sizes
#define SYSTEM_TASK_STACKSIZE (2* configMINIMAL_STACK_SIZE)
#define ADC_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define PM_TASK_STACKSIZE configMINIMAL_STACK_SIZE
Expand All @@ -117,6 +135,9 @@
#define SYSLINK_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define USBLINK_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define PROXIMITY_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define UART_RX_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define INFO_TASK_STACKSIZE configMINIMAL_STACK_SIZE
#define PID_CTRL_TASK_STACKSIZE configMINIMAL_STACK_SIZE

//The radio channel. From 0 to 125
#define RADIO_CHANNEL 80
Expand Down
Loading

0 comments on commit 28b6f16

Please sign in to comment.