From 05dec6c21e482ae24056b6f724f1b69b6474d4f2 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Thu, 15 Oct 2015 09:33:24 +0200 Subject: [PATCH] Revert "Remove OpenPilot bootloader support." This reverts commit 0150abf1bc64848ab5ac4443a32ca2a3ea214b73. Conflicts: src/main/target/CC3D/target.h --- .travis.yml | 1 + Makefile | 16 ++++++++++++++ docs/Sonar.md | 2 ++ docs/development/Building in Mac OS X.md | 6 ++++++ fake_travis_build.sh | 3 ++- src/main/target/CC3D/target.h | 13 +++--------- src/main/target/stm32_flash_f103_128k_opbl.ld | 21 +++++++++++++++++++ 7 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 src/main/target/stm32_flash_f103_128k_opbl.ld diff --git a/.travis.yml b/.travis.yml index 0380f72fe..754a436b8 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ env: - PUBLISHMETA=True - PUBLISHDOCS=True - TARGET=CC3D + - TARGET=CC3D OPBL=yes - TARGET=COLIBRI_RACE - TARGET=CHEBUZZF3 - TARGET=CJMCU diff --git a/Makefile b/Makefile index 8fb4136de..913093ec7 100755 --- a/Makefile +++ b/Makefile @@ -20,6 +20,9 @@ TARGET ?= NAZE # Compile-time options OPTIONS ?= +# compile for OpenPilot BootLoader support +OPBL ?=no + # Debugger optons, must be empty or GDB DEBUG ?= @@ -37,6 +40,9 @@ FORKNAME = betaflight VALID_TARGETS = NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 CC3D CJMCU EUSTM32F103RC SPRACINGF3 PORT103R SPARKY ALIENWIIF1 ALIENWIIF3 COLIBRI_RACE MOTOLAB RMDO +# Valid targets for OP BootLoader support +OPBL_VALID_TARGETS = CC3D + # Configure default flash sizes for the targets ifeq ($(FLASH_SIZE),) ifeq ($(TARGET),$(filter $(TARGET),CJMCU)) @@ -404,6 +410,16 @@ OLIMEXINO_SRC = startup_stm32f10x_md_gcc.S \ $(HIGHEND_SRC) \ $(COMMON_SRC) +ifeq ($(OPBL),yes) +ifneq ($(filter $(TARGET),$(OPBL_VALID_TARGETS)),) +TARGET_FLAGS := -DOPBL $(TARGET_FLAGS) +LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_$(FLASH_SIZE)k_opbl.ld +.DEFAULT_GOAL := binary +else +$(error OPBL specified with a unsupported target) +endif +endif + CJMCU_SRC = \ startup_stm32f10x_md_gcc.S \ drivers/adc.c \ diff --git a/docs/Sonar.md b/docs/Sonar.md index f42fdc935..02dbb8a5f 100644 --- a/docs/Sonar.md +++ b/docs/Sonar.md @@ -39,6 +39,8 @@ Current meter cannot be used in conjunction with Sonar. | ------------- | ------------- | ------------------- | | PB5 | PB0 | YES (3.3v input) | +Sonar support is not available when using the OpenPilot bootloader (OPBL). + #### Constraints Sonar cannot be used in conjuction with SoftSerial or Parallel PWM. diff --git a/docs/development/Building in Mac OS X.md b/docs/development/Building in Mac OS X.md index ddad2e706..5aadf0c6f 100755 --- a/docs/development/Building in Mac OS X.md +++ b/docs/development/Building in Mac OS X.md @@ -105,3 +105,9 @@ git pull make clean TARGET=NAZE make TARGET=NAZE ``` + +Or in the case of CC3D in need of a `obj/cleanflight_CC3D.bin` +``` +make clean TARGET=CC3D +make TARGET=CC3D OPBL=yes +``` \ No newline at end of file diff --git a/fake_travis_build.sh b/fake_travis_build.sh index e3a696618..f6c510c21 100755 --- a/fake_travis_build.sh +++ b/fake_travis_build.sh @@ -3,6 +3,7 @@ targets=("PUBLISHMETA=True" \ "RUNTESTS=True" \ "TARGET=CC3D" \ + "TARGET=CC3D OPBL=yes" \ "TARGET=CHEBUZZF3" \ "TARGET=CJMCU" \ "TARGET=COLIBRI_RACE" \ @@ -25,7 +26,7 @@ export TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG:=$USER/simulated} for target in "${targets[@]}" do - unset RUNTESTS PUBLISHMETA TARGET + unset RUNTESTS PUBLISHMETA TARGET OPBL eval "export $target" make clean ./.travis.sh diff --git a/src/main/target/CC3D/target.h b/src/main/target/CC3D/target.h index c61a12758..5b51f9734 100644 --- a/src/main/target/CC3D/target.h +++ b/src/main/target/CC3D/target.h @@ -132,20 +132,13 @@ #define S1W_RX_GPIO GPIOB #define S1W_RX_PIN GPIO_Pin_11 -#if defined(OPBL) -// disabled some features for OPBL build due to code size. -#undef AUTOTUNE -#undef BARO -#undef DISPLAY -#undef SONAR -#define SKIP_CLI_COMMAND_HELP -#endif - #if defined(OPBL) && defined(USE_SERIAL_1WIRE) #undef DISPLAY +#undef SONAR +#undef BARO +#define SKIP_CLI_COMMAND_HELP #endif - #define SPEKTRUM_BIND // USART3, PB11 (Flexport) #define BIND_PORT GPIOB diff --git a/src/main/target/stm32_flash_f103_128k_opbl.ld b/src/main/target/stm32_flash_f103_128k_opbl.ld new file mode 100644 index 000000000..a8fad3a5f --- /dev/null +++ b/src/main/target/stm32_flash_f103_128k_opbl.ld @@ -0,0 +1,21 @@ +/* +***************************************************************************** +** +** File : stm32_flash.ld +** +** Abstract : Linker script for STM32F103CB Device with +** 128KByte FLASH, 20KByte RAM +** +***************************************************************************** +*/ + +/* Specify the memory areas. */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08003000, LENGTH = 126K - 0x03000 /* last 2kb used for config storage first 12k for OP Bootloader*/ + + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K + MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K +} + +INCLUDE "stm32_flash.ld"