diff options
| author | Dave Hylands | 2014-02-17 17:57:13 -0800 |
|---|---|---|
| committer | Dave Hylands | 2014-02-17 21:20:38 -0800 |
| commit | 51dabac0961165cd38cdd0ba227aaf014190091c (patch) | |
| tree | 48b8d13742ed402b9e37f8b42bc19b4dffa32da9 /stm/Makefile | |
| parent | 46239413d033a25662700ba39a97b07737b820fc (diff) | |
Add pin mapping code.
This commit also introduces board directories and moves board
specific config into the appropriate board directory.
boards/stm32f4xx-af.csv was extracted from the STM32F4xx datasheet
and hand-tweaked.
make-pins.py takes boards/stm32f4xx-af.csv, boards/stm32f4xx-prefix.c,
and boards/BOARD-NAME/pins.csv as input and generates the file
build/pins_BOARD_NAME.c
The generated pin file for PYBOARD4 looks like this:
https://gist.github.com/dhylands/9063231
The generated pins file includes all of the supported alternate
functions, and includes upsupported alternate functions as comments.
See the commnet block at the top of stm/pin_map.c for details on
how to use the pin mapper.
I also went ahead and modified stm/gpio.c to use the pin mapper.
Diffstat (limited to 'stm/Makefile')
| -rw-r--r-- | stm/Makefile | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/stm/Makefile b/stm/Makefile index e2adddbfd..14b690fc0 100644 --- a/stm/Makefile +++ b/stm/Makefile @@ -24,6 +24,9 @@ CFLAGS += -I$(STMUSBH_DIR) CFLAGS += -I$(FATFS_DIR) #CFLAGS += -I$(CC3K_DIR) +BOARD ?= PYBOARD4 +CFLAGS += -Iboards/$(BOARD) + #Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -g @@ -68,6 +71,9 @@ SRC_C = \ adc.c \ rtc.c \ file.c \ + pin.c \ + pin_named_pins.c \ + pin_map.c \ # pybwlan.c \ SRC_S = \ @@ -155,6 +161,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_STMUSBD:.c=.o)) #OBJ += $(addprefix $(BUILD)/, $(SRC_STMUSBH:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_FATFS:.c=.o)) #OBJ += $(addprefix $(BUILD)/, $(SRC_CC3K:.c=.o)) +OBJ += $(BUILD)/pins_$(BOARD).o all: $(BUILD)/flash.dfu @@ -173,4 +180,16 @@ $(BUILD)/flash.elf: $(OBJ) $(Q)$(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(Q)$(SIZE) $@ +MAKE_PINS = boards/make-pins.py +BOARD_PINS = boards/$(BOARD)/pins.csv +AF_FILE = boards/stm32f4xx-af.csv +PREFIX_FILE = boards/stm32f4xx-prefix.c + +$(BUILD)/pins_$(BOARD).c: $(MAKE_PINS) $(BOARD_PINS) $(AF_FILE) $(PREFIX_FILE) + $(ECHO) "Create $@" + $(Q)python $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) > $@ + +$(BUILD)/pins_$(BOARD).o: $(BUILD)/pins_$(BOARD).c + $(call compile_c) + include ../py/mkrules.mk |
