Skip to content

Commit

Permalink
restructured
Browse files Browse the repository at this point in the history
  • Loading branch information
fishpepper committed Aug 29, 2016
1 parent ab261af commit c4c1bd6
Show file tree
Hide file tree
Showing 129 changed files with 126 additions and 26 deletions.
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#select target. supported: {VD5M, D4RII}
TARGET ?= VD5M
TARGET ?= USKY
#TARGET ?= VD5M
#TARGET ?= D4RII

CFLAGS = -O1 -g
ASFLAGS = -g
GENERIC_SRCS = main.c debug.c assert.c clocksource.c timeout.c wdt.c delay.c frsky.c spi.c cc25xx.c
GENERIC_SRCS += io.c storage.c failsafe.c ppm.c adc.c sbus.c apa102.c soft_spi.c soft_serial.c telemetry.c

ifneq (,$(wildcard .use_fixed_id))
#a special file can trigger the use of a fixed id (see storage.c)
#i use this during development to avoid uneccessary re-binding for vd5m targets
ifneq ($(wildcard .use_fixed_id),)
CFLAGS += -DFRSKY_USE_FIXED_ID
endif

Expand All @@ -17,8 +19,11 @@ else
ifeq ($(TARGET),VD5M)
include board/vd5m/Makefile.board
else
@echo "ERROR, UNSUPPORTED TARGET"
@exit 0
ifeq ($(TARGET),USKY)
include board/usky/Makefile.board
else
$(error UNSUPPORTED Target ($(TARGET)) given. aborting)
endif
endif
endif

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 12 additions & 8 deletions board/d4rii/Makefile.board
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ RESULT ?= opensky_$(notdir $(TARGET))
#faster build
MAKEFLAGS+="-j6 "

#opt
CFLAGS += -O1 -g

# include path
CFLAGS += -I$(SELF_DIR)

Expand All @@ -29,14 +32,15 @@ AS=$(TOOLROOT)/arm-none-eabi-as
OBJ=$(TOOLROOT)/arm-none-eabi-objcopy

# Code Paths
DEVICE=$(SELF_DIR)/device
CORE =$(SELF_DIR)/core
LINK =$(SELF_DIR)/linker
PERIPH=$(SELF_DIR)/peripheral_lib
ARCH_DIR=arch/stm32f1
DEVICE=$(ARCH_DIR)/device
CORE =$(ARCH_DIR)/core
LINK =$(ARCH_DIR)/linker
PERIPH=$(ARCH_DIR)/peripheral_lib

# Search path for standard files
vpath %.c ./
vpath %.c $(SELF_DIR)
vpath %.c $(ARCH_DIR)

# Search path for perpheral library
vpath %.c $(CORE)
Expand All @@ -55,15 +59,15 @@ FULLASSERT = -DUSE_FULL_ASSERT
LDFLAGS+= -T$(LDSCRIPT) -mthumb -mcpu=cortex-m3
CFLAGS+= -mcpu=cortex-m3 -mthumb
CFLAGS+= -DHSE_VALUE=$(CRYSTAL_FREQ)
CFLAGS+= -I$(DEVICE) -I$(CORE) -I$(PERIPH)/inc -I.
CFLAGS+= -I$(DEVICE) -I$(CORE) -I$(PERIPH)/inc -I. -I$(ARCH_DIR)
CFLAGS+= -D$(PTYPE) -DUSE_STDPERIPH_DRIVER $(FULLASSERT) -DBUILD_TARGET=$(TARGET)

OPENOCD_PIDFILE = /tmp/openocd_opensky.pid

LINK_OBJS=$(BOARD_SRCS:%.c=%.o)

HEADER_FILES = $(wildcard $(SELF_DIR)/*.h)
HEADER_FILES += $(wildcard ./*.h)
HEADER_FILES = $(wildcard $(ARCH_DIR)/*.h)
HEADER_FILES += config.h

# Build executable
board: $(RESULT).elf
Expand Down
52 changes: 52 additions & 0 deletions board/usky/Makefile.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
CC = sdcc
CFLAGS += --model-small --opt-code-speed -I /usr/share/sdcc/include
LDFLAGS_FLASH = \
--out-fmt-ihx \
--code-loc 0x000 --code-size 0x4000 \
--xram-loc 0xf000 --xram-size 0x300 \
--iram-size 0x100
ifdef DEBUG
CFLAGS += --debug
endif

#programmer binary
CC_TOOL ?= cc-tool

RESULT ?= opensky_$(notdir $(TARGET))

# fetch this dir during include
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
ARCH_DIR = arch/cc251x
CFLAGS += -I$(SELF_DIR) -I ./ -I$(ARCH_DIR)
HAL_SRC = hal_led.c hal_uart.c hal_clocksource.c hal_timeout.c hal_wdt.c hal_delay.c hal_dma.c hal_spi.c
HAL_SRC += hal_cc25xx.c hal_io.c hal_adc.c hal_storage.c hal_sbus.c hal_ppm.c hal_soft_spi.c hal_soft_serial.c
SRC = $(GENERIC_SRCS) $(HAL_SRC:%.c=$(ARCH_DIR)/%.c)
ADB=$(SRC:.c=.adb)
ASM=$(SRC:.c=.asm)
LNK=$(SRC:.c=.lnk)
LST=$(SRC:.c=.lst)
REL=$(SRC:.c=.rel)
RST=$(SRC:.c=.rst)
SYM=$(SRC:.c=.sym)

OUTPUT=$(RESULT).hex

PCDB=$(PROGS:.hex=.cdb)
PLNK=$(PROGS:.hex=.lnk)
PMAP=$(PROGS:.hex=.map)
PMEM=$(PROGS:.hex=.mem)
PAOM=$(PROGS:.hex=)
%.rel : %.c
$(CC) -c $(CFLAGS) -o$*.rel $<

board: $(OUTPUT)

$(OUTPUT): $(REL) Makefile
$(CC) $(LDFLAGS_FLASH) $(CFLAGS) -o $(OUTPUT) $(REL)
clean:
rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)

flash: $(RESULT).hex
$(CC_TOOL) -f -e -w $(RESULT).hex
47 changes: 47 additions & 0 deletions board/usky/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "portmacros.h"

//pin layout ISP header
#define ISP_DATA P2_1
#define ISP_CLOCK P2_2

#define PPM_OUT_PIN 4

//note: change of adc ch require change in adc.c!
#define ADC_PORT P0
#define ADC0 5
#define ADC1 6
//acs712 in inverted mode on adc1?
//when powered by 5V we can use a trick
//to get a good resolution: use inverted power inputs
// 0A = 2.5V
//30A = 0.0V
#define ADC1_USE_ACS712 1

//voltage divider on my board is 10 / 5.6 k, scale to 100 / 56 to avoid floating point calc
#define ADC0_DIVIDER_A 100
#define ADC0_DIVIDER_B 56

//APA102 SPI CLOCK
#define SOFT_SPI_CLOCK_PORT P2
#define SOFT_SPI_CLOCK_PIN 1
//APA102 SPI DATA
#define SOFT_SPI_MOSI_PORT P2
#define SOFT_SPI_MOSI_PIN 2

//P0.2 is NC! change this to P0.3 (debug tx)
#define BIND_PORT P0
#define BIND_PIN 2

//leds
#define LED_GREEN_PORT P1
#define LED_GREEN_PIN 1
//re led is NC!
#define LED_RED_PORT P1
#define LED_RED_PIN 2


//hub telemetry input (will run a soft serial port)
#define SOFT_SERIAL_PORT P2
#define SOFT_SERIAL_PIN 1


7 changes: 4 additions & 3 deletions board/vd5m/Makefile.board
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
CC = sdcc
CFLAGS = --model-small --opt-code-speed -I /usr/share/sdcc/include
CFLAGS += --model-small --opt-code-speed -I /usr/share/sdcc/include
LDFLAGS_FLASH = \
--out-fmt-ihx \
--code-loc 0x000 --code-size 0x4000 \
Expand All @@ -17,10 +17,11 @@ RESULT ?= opensky_$(notdir $(TARGET))

# fetch this dir during include
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
CFLAGS += -I$(SELF_DIR) -I ./
ARCH_DIR = arch/cc251x
CFLAGS += -I$(SELF_DIR) -I ./ -I$(ARCH_DIR)
HAL_SRC = hal_led.c hal_uart.c hal_clocksource.c hal_timeout.c hal_wdt.c hal_delay.c hal_dma.c hal_spi.c
HAL_SRC += hal_cc25xx.c hal_io.c hal_adc.c hal_storage.c hal_sbus.c hal_ppm.c hal_soft_spi.c hal_soft_serial.c
SRC = $(GENERIC_SRCS) $(HAL_SRC:%.c=board/vd5m/%.c)
SRC = $(GENERIC_SRCS) $(HAL_SRC:%.c=$(ARCH_DIR)/%.c)
ADB=$(SRC:.c=.adb)
ASM=$(SRC:.c=.asm)
LNK=$(SRC:.c=.lnk)
Expand Down
11 changes: 1 addition & 10 deletions board/vd5m/config.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
#include "portmacros.h"

/*
#define DEBUG_PIN_INIT() {PORT2DIR(P0) |= (1<<6); ADCCFG &= ~((1<<ADC1) | (1<<ADC0));}
#define DEBUG_PIN_BIT PORT2BIT(P0, 6)
#define DEBUG_PIN_TOGGLE() { DEBUG_PIN_BIT = !DEBUG_PIN_BIT; }
#define DEBUG_PIN_HI() { DEBUG_PIN_BIT = 1; }
#define DEBUG_PIN_LO() { DEBUG_PIN_BIT = 0; }
*/


//pin layout ISP header
#define ISP_DATA P2_1
#define ISP_CLOCK P2_2
Expand Down Expand Up @@ -63,7 +54,7 @@
#define LED_RED_PIN 3


//hub telemetry input NOTE: this has to be a timer io
//hub telemetry input (soft serial)
#define SOFT_SERIAL_PORT P0
#define SOFT_SERIAL_PIN 7

Expand Down
File renamed without changes.

0 comments on commit c4c1bd6

Please sign in to comment.