mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Create firmware/Makefile
New Makefile calls out to component Makefiles, builds SPI flash image, performs device programming, builds release archive. Resolves #28.
This commit is contained in:
parent
c2441a6e3e
commit
10e20ee763
84
firmware/Makefile
Normal file
84
firmware/Makefile
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||||
|
#
|
||||||
|
# This file is part of PortaPack.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
|
# Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
PATH_BOOTSTRAP=bootstrap
|
||||||
|
PATH_APP_M0=application
|
||||||
|
PATH_APP_M4=baseband
|
||||||
|
|
||||||
|
PAD_BOOTSTRAP=0x10000
|
||||||
|
PAD_M4=0x10000
|
||||||
|
|
||||||
|
TARGET=portapack-h1-firmware
|
||||||
|
|
||||||
|
TARGET_BOOTSTRAP=$(PATH_BOOTSTRAP)/bootstrap
|
||||||
|
TARGET_M0=$(PATH_APP_M0)/build/application
|
||||||
|
TARGET_M4=$(PATH_APP_M4)/build/baseband
|
||||||
|
|
||||||
|
DFU_HACKRF=hackrf_one_usb_ram.dfu
|
||||||
|
LICENSE=../LICENSE
|
||||||
|
|
||||||
|
REVISION=$(shell git log -n 1 --format=%h)
|
||||||
|
|
||||||
|
CP=arm-none-eabi-objcopy
|
||||||
|
|
||||||
|
all: $(TARGET).bin
|
||||||
|
|
||||||
|
release: $(TARGET).bin $(DFU_HACKRF) $(LICENSE)
|
||||||
|
# TODO: Bad hack to fix location of LICENSE file for tar.
|
||||||
|
cp $(LICENSE) LICENSE
|
||||||
|
tar -c -j -f $(TARGET)-$(REVISION).tar.bz2 $(TARGET).bin $(DFU_HACKRF) LICENSE
|
||||||
|
zip -9 -q $(TARGET)-$(REVISION).zip $(TARGET).bin $(DFU_HACKRF) LICENSE
|
||||||
|
rm -f LICENSE
|
||||||
|
|
||||||
|
program: $(TARGET).bin
|
||||||
|
dfu-util --device 1fc9 --download hackrf_one_usb_ram.dfu --reset
|
||||||
|
sleep 1s
|
||||||
|
hackrf_spiflash -w $(TARGET).bin
|
||||||
|
|
||||||
|
$(TARGET).bin: $(TARGET_BOOTSTRAP)_pad.bin $(TARGET_M4)_pad.bin $(TARGET_M0).bin
|
||||||
|
cat $(TARGET_BOOTSTRAP)_pad.bin $(TARGET_M4)_pad.bin $(TARGET_M0).bin >$(TARGET).bin
|
||||||
|
|
||||||
|
$(TARGET_BOOTSTRAP)_pad.bin: $(TARGET_BOOTSTRAP).elf
|
||||||
|
$(CP) -O binary --pad-to $(PAD_BOOTSTRAP) $(TARGET_BOOTSTRAP).elf $(TARGET_BOOTSTRAP)_pad.bin
|
||||||
|
|
||||||
|
$(TARGET_M4)_pad.bin: $(TARGET_M4).elf
|
||||||
|
$(CP) -O binary --pad-to $(PAD_M4) $(TARGET_M4).elf $(TARGET_M4)_pad.bin
|
||||||
|
|
||||||
|
$(TARGET_M0).bin: $(TARGET_M0).elf
|
||||||
|
$(CP) -O binary $(TARGET_M0).elf $(TARGET_M0).bin
|
||||||
|
|
||||||
|
$(TARGET_M4).elf:
|
||||||
|
$(MAKE) -C $(PATH_APP_M4)
|
||||||
|
|
||||||
|
$(TARGET_M0).elf:
|
||||||
|
$(MAKE) -C $(PATH_APP_M0)
|
||||||
|
|
||||||
|
$(TARGET_BOOTSTRAP).elf:
|
||||||
|
$(MAKE) -C $(PATH_BOOTSTRAP)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(TARGET).bin
|
||||||
|
rm -f $(TARGET_BOOTSTRAP)_pad.bin
|
||||||
|
rm -f $(TARGET_M4)_pad.bin
|
||||||
|
rm -f $(TARGET_M0).bin
|
||||||
|
$(MAKE) -C $(PATH_APP_M4) clean
|
||||||
|
$(MAKE) -C $(PATH_APP_M0) clean
|
||||||
|
$(MAKE) -C $(PATH_BOOTSTRAP) clean
|
@ -19,15 +19,6 @@
|
|||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
|
|
||||||
PATH_COMMON=../common
|
|
||||||
PATH_APP_M0=../application
|
|
||||||
TARGET_M0=$(PATH_APP_M0)/build/application
|
|
||||||
APP_M0_SRC=$(PATH_APP_M0)/*.cpp $(PATH_APP_M0)/*.hpp $(PATH_COMMON)/*.cpp $(PATH_COMMON)/*.hpp
|
|
||||||
|
|
||||||
PATH_APP_M4=../baseband
|
|
||||||
TARGET_M4=$(PATH_APP_M4)/build/baseband
|
|
||||||
APP_M4_SRC=$(PATH_APP_M4)/*.cpp $(PATH_APP_M4)/*.hpp $(PATH_COMMON)/*.cpp $(PATH_COMMON)/*.hpp
|
|
||||||
|
|
||||||
TARGET=bootstrap
|
TARGET=bootstrap
|
||||||
|
|
||||||
CC=arm-none-eabi-gcc
|
CC=arm-none-eabi-gcc
|
||||||
@ -58,20 +49,7 @@ LDOPT=-nostartfiles \
|
|||||||
-D__START=main \
|
-D__START=main \
|
||||||
-Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch,--library-path=.,--script=m4.ld,--gc-sections
|
-Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch,--library-path=.,--script=m4.ld,--gc-sections
|
||||||
|
|
||||||
all: image.bin
|
all: $(TARGET).elf
|
||||||
|
|
||||||
list: $(TARGET).lst $(TARGET_M4).lst $(TARGET_M0).lst
|
|
||||||
|
|
||||||
program: image.bin
|
|
||||||
dfu-util --device 1fc9 --download hackrf_one_usb_ram.dfu --reset
|
|
||||||
sleep 1s
|
|
||||||
hackrf_spiflash -w image.bin
|
|
||||||
|
|
||||||
image.bin: $(TARGET).elf $(TARGET_M4).elf $(TARGET_M0).elf
|
|
||||||
$(CP) -O binary --pad-to 0x10000 $(TARGET).elf $(TARGET).bin
|
|
||||||
$(CP) -O binary --pad-to 0x10000 $(TARGET_M4).elf m4.bin
|
|
||||||
$(CP) -O binary $(TARGET_M0).elf m0.bin
|
|
||||||
cat $(TARGET).bin m4.bin m0.bin >image.bin
|
|
||||||
|
|
||||||
$(TARGET).lst: $(TARGET).elf
|
$(TARGET).lst: $(TARGET).elf
|
||||||
$(OBJDUMP) -S $(TARGET).elf >$(TARGET).lst
|
$(OBJDUMP) -S $(TARGET).elf >$(TARGET).lst
|
||||||
@ -82,22 +60,5 @@ $(TARGET).elf: $(TARGET).o startup_ARMCM4.S
|
|||||||
$(TARGET).o: $(TARGET).c
|
$(TARGET).o: $(TARGET).c
|
||||||
$(CC) $(COPT) $(INCLUDE) -c -o $(TARGET).o $(TARGET).c
|
$(CC) $(COPT) $(INCLUDE) -c -o $(TARGET).o $(TARGET).c
|
||||||
|
|
||||||
$(TARGET_M4).lst: $(TARGET_M4).elf
|
|
||||||
$(OBJDUMP) -S $(TARGET_M4).elf >$(TARGET_M4).lst
|
|
||||||
|
|
||||||
$(TARGET_M4).elf: $(PATH_APP_M4)/Makefile $(APP_M4_SRC)
|
|
||||||
$(MAKE) -C $(PATH_APP_M4) -f Makefile
|
|
||||||
|
|
||||||
$(TARGET_M0).lst: $(TARGET_M0).elf
|
|
||||||
$(OBJDUMP) -S $(TARGET_M0).elf >$(TARGET_M0).lst
|
|
||||||
|
|
||||||
$(TARGET_M0).elf: $(PATH_APP_M0)/Makefile $(APP_M0_SRC)
|
|
||||||
$(MAKE) -C $(PATH_APP_M0) -f Makefile
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f image.bin m0.bin m4.bin
|
|
||||||
rm -f $(TARGET).o $(TARGET).elf $(TARGET).bin $(TARGET).lst $(TARGET).map
|
rm -f $(TARGET).o $(TARGET).elf $(TARGET).bin $(TARGET).lst $(TARGET).map
|
||||||
$(MAKE) -C $(PATH_APP_M4) -f Makefile clean
|
|
||||||
rm -f $(TARGET_M4).lst
|
|
||||||
$(MAKE) -C $(PATH_APP_M0) -f Makefile clean
|
|
||||||
rm -f $(TARGET_M0).lst
|
|
||||||
|
Loading…
Reference in New Issue
Block a user