Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
Update for new libswiftnav, link against BLAS and LAPACK. Reduce size…
Browse files Browse the repository at this point in the history
… of Coffee FS area to give space for more code.
  • Loading branch information
fnoble committed Mar 20, 2014
1 parent 9304eb5 commit 33bfec0
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,36 @@ else
MAKEFLAGS += PRN=$(PRN)
endif

.PHONY: all tests firmware bootloader docs libopencm3 libswiftnav
.PHONY: all tests firmware bootloader docs .FORCE

all: firmware bootloader tests

firmware: libopencm3 libswiftnav
firmware: libopencm3/lib/libopencm3_stm32f4.a libswiftnav/build/src/libswiftnav-static.a
@printf "BUILD src\n"; \
$(MAKE) -C src $(MAKEFLAGS)
$(MAKE) -r -C src $(MAKEFLAGS)

bootloader:
@printf "BUILD bootloader\n"; \
$(MAKE) -C bootloader $(MAKEFLAGS)
$(MAKE) -r -C bootloader $(MAKEFLAGS)

tests:
$(Q)for i in tests/*; do \
if [ -d $$i ]; then \
printf "BUILD $$i\n"; \
$(MAKE) -C $$i $(MAKEFLAGS) || exit $?; \
$(MAKE) -r -C $$i $(MAKEFLAGS) || exit $?; \
fi; \
done

libopencm3:
libopencm3/lib/libopencm3_stm32f4.a: .FORCE
@printf "BUILD libopencm3\n"; \
$(MAKE) -C libopencm3 $(MAKEFLAGS) lib/stm32/f4

libswiftnav:
libswiftnav/build/src/libswiftnav-static.a: .FORCE
@printf "BUILD libswiftnav\n"; \
mkdir -p libswiftnav/build; cd libswiftnav/build; \
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-arm-embedded.cmake $(CMAKEFLAGS) ../

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-arm-embedded.cmake $(CMAKEFLAGS) ../
$(MAKE) -C libswiftnav/build $(MAKEFLAGS)

clean:
@printf "CLEAN src\n"; \
$(MAKE) -C src $(MAKEFLAGS) clean
Expand All @@ -68,3 +68,5 @@ docs:
$(MAKE) -C docs/diagrams
doxygen docs/Doxyfile

.FORCE:

2 changes: 1 addition & 1 deletion bootloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ LDFLAGS += -lc -lnosys -T$(LDSCRIPT) -nostartfiles \
-Wl,-wrap,printf -Wl,--gc-sections \
-mcpu=cortex-m4 -march=armv7e-m -mthumb \
-mfloat-abi=hard -mfpu=fpv4-sp-d16 \
-lopencm3_stm32f4 -lswiftnav-static-cortex-m4 -lm \
-lopencm3_stm32f4 -lswiftnav-static -lm \
-L$(SWIFTNAV_ROOT)/libopencm3/lib \
-L$(SWIFTNAV_ROOT)/libswiftnav/build/src

Expand Down
2 changes: 1 addition & 1 deletion libswiftnav
2 changes: 1 addition & 1 deletion src/cfs/cfs-coffee-arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern u32 _coffee_fs_area;
extern u32 _ecoffee_fs_area;

#define COFFEE_START ((u32)&_coffee_fs_area)
#define COFFEE_START_SECTOR 6
#define COFFEE_START_SECTOR 7
#define COFFEE_SIZE ((u32)&_ecoffee_fs_area - (u32)&_coffee_fs_area)
#define COFFEE_NAME_LENGTH 8 /* The maximum filename length. */
#define COFFEE_MAX_OPEN_FILES 8
Expand Down
9 changes: 7 additions & 2 deletions stm32/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@ CFLAGS += -I$(SWIFTNAV_ROOT)/src \
-I$(SWIFTNAV_ROOT)/libswiftnav/include

LDSCRIPT ?= $(SWIFTNAV_ROOT)/stm32/swiftnav.ld
LDFLAGS += -lc -lnosys -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections \
LDFLAGS += -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections \
-mcpu=cortex-m4 -march=armv7e-m -mthumb \
-mfloat-abi=hard -mfpu=fpv4-sp-d16 \
-lopencm3_stm32f4 -lswiftnav-static-cortex-m4 -lm \
-lopencm3_stm32f4 -lswiftnav-static -llapacke -llapack -lcblas -lblas -lf2c -lm -lc -lnosys \
-L$(SWIFTNAV_ROOT)/libopencm3/lib \
-L$(SWIFTNAV_ROOT)/libswiftnav/build/lapacke \
-L$(SWIFTNAV_ROOT)/libswiftnav/build/CBLAS/src \
-L$(SWIFTNAV_ROOT)/libswiftnav/build/clapack-3.2.1-CMAKE/BLAS/SRC \
-L$(SWIFTNAV_ROOT)/libswiftnav/build/clapack-3.2.1-CMAKE/SRC \
-L$(SWIFTNAV_ROOT)/libswiftnav/build/clapack-3.2.1-CMAKE/F2CLIBS/libf2c \
-L$(SWIFTNAV_ROOT)/libswiftnav/build/src

OOCD ?= openocd
Expand Down
12 changes: 9 additions & 3 deletions stm32/swiftnav.ld
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
MEMORY
{
/* Bootloader occupies first sector of flash. */
rom (rx) : ORIGIN = 0x08004000, LENGTH = 240K
coffee_fs_rom (r) : ORIGIN = 0x08040000, LENGTH = 768K
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
rom (rx) : ORIGIN = 0x08004000, LENGTH = 368K
coffee_fs_rom (r) : ORIGIN = 0x08060000, LENGTH = 640K
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
/* STM32F4 Core Coupled Memory, not accesible by peripherals or DMA. */
ccm (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
}
Expand All @@ -25,6 +25,12 @@ MEMORY
INCLUDE libopencm3_stm32f4.ld

SECTIONS {
. = ALIGN(0x4);
_init = . ;

. = ALIGN(0x4);
_fini = . ;

_stack_size = 65536;
_stack = ORIGIN(ccm)+LENGTH(ccm);
_stack_begin = _stack - _stack_size;
Expand Down

0 comments on commit 33bfec0

Please sign in to comment.