Github action build for embedded/ubuntu/windows
This commit is contained in:
parent
efcd5e8347
commit
e1dfa7ee55
151
.github/workflows/Build.yml
vendored
Normal file
151
.github/workflows/Build.yml
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
PC_Application_Ubuntu:
|
||||
needs: create_release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get install -y libusb-1.0-0-dev libqwt-qt5-dev qt5-default qt5-qmake qtbase5-dev
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
qmake
|
||||
make -j9
|
||||
shell: bash
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Application_Ubuntu
|
||||
path: Software/PC_Application/Application
|
||||
|
||||
PC_Application_Windows:
|
||||
needs: create_release
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Cache Qt
|
||||
id: cache-qt
|
||||
uses: pat-s/always-upload-cache@v2.1.0
|
||||
with:
|
||||
path: ${{ runner.workspace }}/Qt
|
||||
key: ${{ runner.os }}-QtCache
|
||||
|
||||
- name: Cache Qwt
|
||||
id: cache-qwt
|
||||
uses: pat-s/always-upload-cache@v2.1.0
|
||||
with:
|
||||
path: C:\Qwt-6.1.4
|
||||
key: ${{ runner.os }}-QwtCache
|
||||
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v2
|
||||
with:
|
||||
arch: 'win64_mingw73'
|
||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||
|
||||
- name: Download and Install Qwt
|
||||
if: steps.cache-qwt.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
curl -o qwt.zip -L https://sourceforge.net/projects/qwt/files/qwt/6.1.4/qwt-6.1.4.zip/download
|
||||
7z x qwt.zip -r -oQwt
|
||||
cd Qwt\qwt-6.1.4
|
||||
qmake qwt.pro
|
||||
make install
|
||||
shell: cmd
|
||||
|
||||
- name: Download libusb
|
||||
run: |
|
||||
curl -o libusb.7z -L https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.7z
|
||||
7z x libusb.7z -r -olibusb
|
||||
Xcopy /E /I /Y libusb\include ..\Qt\5.12.9\mingw73_64\include
|
||||
Xcopy /E /I /Y libusb\MinGW64\static C:\Qwt-6.1.4\lib
|
||||
dir
|
||||
dir ..\Qt\5.12.9
|
||||
dir ..\Qt\5.12.9\mingw73_64
|
||||
dir C:\Qwt-6.1.4\lib
|
||||
dir ..\Qt\5.12.9\mingw73_64\bin
|
||||
shell: cmd
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/PC_Application
|
||||
qmake
|
||||
make -j9
|
||||
cd release
|
||||
del *.o *.cpp
|
||||
windeployqt.exe .
|
||||
copy ..\..\..\..\Qt\5.12.9\mingw73_64\bin\libwinpthread-1.dll .
|
||||
copy ..\..\..\..\Qt\5.12.9\mingw73_64\bin\libgcc_s_seh-1.dll .
|
||||
copy "..\..\..\..\Qt\5.12.9\mingw73_64\bin\libstdc++-6.dll" .
|
||||
copy ..\..\..\..\Qt\5.12.9\mingw73_64\bin\Qt5OpenGL.dll .
|
||||
copy C:\Qwt-6.1.4\lib\qwt.dll .
|
||||
shell: cmd
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Application_Windows
|
||||
path: Software/PC_Application/release
|
||||
|
||||
Embedded_Firmware:
|
||||
needs: create_release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
- name: Install toolchain
|
||||
run: |
|
||||
sudo apt-get install -y gcc-arm-none-eabi binutils-arm-none-eabi
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
cd Software/VNA_embedded
|
||||
make -j9
|
||||
cp build/VNA_embedded.elf ../../
|
||||
shell: bash
|
||||
|
||||
- name: Combine with FPGA bitstream
|
||||
run: |
|
||||
python3 AssembleFirmware.py
|
||||
shell: bash
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: EmbeddedFirmware
|
||||
path: |
|
||||
VNA_embedded.elf
|
||||
combined.vnafw
|
||||
|
||||
# - name: Publish
|
||||
# if: startsWith(github.ref, 'refs/tags/v')
|
||||
# uses: actions/upload-release-asset@v1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# with:
|
||||
# upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
# # This is how it will be named on the release page. Put hatever name
|
||||
# # you like, remember that they need to be different for each platform.
|
||||
# # You can choose any build matrix parameters. For Rust I use the
|
||||
# # target triple.
|
||||
# asset_name: Application_Windows
|
||||
# # The path to the file you want to upload.
|
||||
# asset_path: Software/PC_Application/release
|
||||
# # probably you will need to change it, but most likely you are
|
||||
# # uploading a binary file
|
||||
# asset_content_type: application/octet-stream
|
@ -4,7 +4,7 @@ import os
|
||||
import binascii
|
||||
|
||||
FPGA_BITSTREAM = "FPGA/VNA/top.bin"
|
||||
MCU_FW = "Software/VNA_embedded/Debug/VNA_embedded.bin"
|
||||
MCU_FW = ["Software/VNA_embedded/Debug/VNA_embedded.bin", "Software/VNA_embedded/Release/VNA_embedded.bin", "Software/VNA_embedded/build/VNA_embedded.bin"]
|
||||
|
||||
HEADER_SIZE = 24
|
||||
|
||||
@ -12,10 +12,24 @@ f = open("combined.vnafw", "wb")
|
||||
f.write(bytes("VNA!", 'utf-8'))
|
||||
|
||||
bitstream = open(FPGA_BITSTREAM, "rb")
|
||||
firmware = open(MCU_FW, "rb")
|
||||
latest_modification = 0
|
||||
newest_mcu = ""
|
||||
for path in MCU_FW:
|
||||
try:
|
||||
modified_time = os.path.getmtime(path)
|
||||
if modified_time >= latest_modification:
|
||||
latest_modification = modified_time
|
||||
newest_mcu = path
|
||||
except:
|
||||
pass
|
||||
if latest_modification == 0:
|
||||
print("Couldn't find MCU firmware file")
|
||||
exit(-1)
|
||||
print("Using "+newest_mcu+" as MCU firmware")
|
||||
firmware = open(newest_mcu, "rb")
|
||||
|
||||
size_FPGA = os.path.getsize(FPGA_BITSTREAM)
|
||||
size_MCU = os.path.getsize(MCU_FW)
|
||||
size_MCU = os.path.getsize(newest_mcu)
|
||||
print("Got FPGA bitstream of size "+str(size_FPGA))
|
||||
print("Got MCU firmware of size "+str(size_MCU))
|
||||
|
||||
@ -37,7 +51,7 @@ def CRC32_from_file(filename, initial_CRC):
|
||||
|
||||
print("Calculating CRC...", end="")
|
||||
CRC = CRC32_from_file(FPGA_BITSTREAM, 0xFFFFFFFF)
|
||||
CRC = CRC32_from_file(MCU_FW, CRC)
|
||||
CRC = CRC32_from_file(newest_mcu, CRC)
|
||||
print(":"+hex(CRC))
|
||||
f.write(CRC.to_bytes(4, byteorder='little'))
|
||||
|
||||
|
2
FPGA/.gitignore
vendored
2
FPGA/.gitignore
vendored
@ -8,4 +8,4 @@
|
||||
!*.gise
|
||||
!*.xise
|
||||
!*.py
|
||||
|
||||
!*.bin
|
||||
|
BIN
FPGA/VNA/top.bin
Normal file
BIN
FPGA/VNA/top.bin
Normal file
Binary file not shown.
2
Software/.gitignore
vendored
2
Software/.gitignore
vendored
@ -1 +1,3 @@
|
||||
/.metadata/
|
||||
RemoteSystemsTempFiles
|
||||
build-*
|
||||
|
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
#include "firmwareupdatedialog.h"
|
||||
#include "ui_firmwareupdatedialog.h"
|
||||
#include <QFileDialog>
|
||||
#include <QStyle>
|
||||
|
||||
FirmwareUpdateDialog::FirmwareUpdateDialog(Device *dev, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -55,9 +55,11 @@
|
||||
|
||||
<option id="fr.ac6.managedbuild.option.gnu.cross.floatabi.1331315324" name="Floating-point ABI" superClass="fr.ac6.managedbuild.option.gnu.cross.floatabi" useByScannerDiscovery="false" value="fr.ac6.managedbuild.option.gnu.cross.floatabi.hard" valueType="enumerated"/>
|
||||
|
||||
<option id="fr.ac6.managedbuild.option.gnu.cross.path.2023424783" name="Path" superClass="fr.ac6.managedbuild.option.gnu.cross.path" useByScannerDiscovery="false" value="/usr/bin" valueType="string"/>
|
||||
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.424800885" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
|
||||
|
||||
<builder arguments="-j5" buildPath="${workspace_loc:/VNA_embedded}/Debug" command="make" id="fr.ac6.managedbuild.builder.gnu.cross.1807206174" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross">
|
||||
<builder arguments="-j5" buildPath="${workspace_loc:/VNA_embedded}/" command="make" id="fr.ac6.managedbuild.builder.gnu.cross.1807206174" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross">
|
||||
|
||||
<outputEntries>
|
||||
|
||||
@ -69,7 +71,7 @@
|
||||
|
||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.1927263688" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
|
||||
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1492730557" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.debug" valueType="enumerated"/>
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1492730557" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.more" valueType="enumerated"/>
|
||||
|
||||
<option id="gnu.c.compiler.option.debugging.level.24507088" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
|
||||
@ -143,7 +145,7 @@
|
||||
|
||||
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1186634618" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
|
||||
<option defaultValue="gnu.cpp.optimization.level.none" id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1296454962" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.debug" valueType="enumerated"/>
|
||||
<option defaultValue="gnu.cpp.optimization.level.none" id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1296454962" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.more" valueType="enumerated"/>
|
||||
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.1713488101" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
|
||||
@ -267,7 +269,7 @@
|
||||
|
||||
</option>
|
||||
|
||||
<option id="gnu.cpp.link.option.flags.1016696662" name="Linker flags" superClass="gnu.cpp.link.option.flags" useByScannerDiscovery="false" value="-specs=nosys.specs -specs=nano.specs" valueType="string"/>
|
||||
<option id="gnu.cpp.link.option.flags.1016696662" name="Linker flags" superClass="gnu.cpp.link.option.flags" useByScannerDiscovery="false" value="-specs=nosys.specs -specs=nano.specs " valueType="string"/>
|
||||
|
||||
<option id="gnu.cpp.link.option.other.1827976887" name="Other options (-Xlinker [option])" superClass="gnu.cpp.link.option.other" useByScannerDiscovery="false"/>
|
||||
|
||||
@ -783,7 +785,7 @@
|
||||
|
||||
<configuration configurationName="Debug">
|
||||
|
||||
<resource resourceType="PROJECT" workspacePath="VNA_embedded"/>
|
||||
<resource resourceType="PROJECT" workspacePath="/VNA_embedded"/>
|
||||
|
||||
</configuration>
|
||||
|
||||
|
1
Software/VNA_embedded/.gitignore
vendored
1
Software/VNA_embedded/.gitignore
vendored
@ -1 +1,2 @@
|
||||
/Debug/
|
||||
/build/
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
|
||||
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1307432939745961523" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1870342659776466326" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "Si5351C.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
#define LOG_LEVEL LOG_LEVEL_INFO
|
||||
#define LOG_MODULE "SI5351"
|
||||
|
216
Software/VNA_embedded/Makefile
Normal file
216
Software/VNA_embedded/Makefile
Normal file
@ -0,0 +1,216 @@
|
||||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [2.25.0] date: [Sat Sep 16 14:17:13 CEST 2017]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
# Generic Makefile (based on gcc)
|
||||
#
|
||||
# ChangeLog :
|
||||
# 2017-02-10 - Several enhancements + project update mode
|
||||
# 2015-07-22 - first version
|
||||
# ------------------------------------------------
|
||||
|
||||
######################################
|
||||
# target
|
||||
######################################
|
||||
TARGET = VNA_embedded
|
||||
|
||||
|
||||
######################################
|
||||
# building variables
|
||||
######################################
|
||||
# debug build?
|
||||
DEBUG = 0
|
||||
# optimization
|
||||
OPT = -O2
|
||||
|
||||
|
||||
#######################################
|
||||
# paths
|
||||
#######################################
|
||||
# source path
|
||||
SOURCES_DIR = \
|
||||
Application \
|
||||
Application/Communication \
|
||||
Application/Drivers \
|
||||
Application/Drivers/FPGA \
|
||||
Application/Drivers/USB \
|
||||
Application/Drivers/USB/Core/Src \
|
||||
Drivers/STM32G4xx_HAL_Driver/Src \
|
||||
Middlewares/Third_Party/FreeRTOS/Source \
|
||||
Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS \
|
||||
Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \
|
||||
Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang \
|
||||
Middlewares/ST/STM32_USBPD_Library/Core/src \
|
||||
Middlewares/ST/STM32_USBPD_Library/Devices/STM32G4XX/src \
|
||||
Src
|
||||
|
||||
# Build path
|
||||
BUILD_DIR = build
|
||||
|
||||
######################################
|
||||
# source
|
||||
######################################
|
||||
# C sources
|
||||
C_SOURCES := $(foreach sdir,$(SOURCES_DIR),$(wildcard $(sdir)/*.c))
|
||||
CXX_SOURCES := $(foreach sdir,$(SOURCES_DIR),$(wildcard $(sdir)/*.cpp))
|
||||
|
||||
|
||||
# ASM sources
|
||||
ASM_SOURCES = \
|
||||
startup/startup_stm32g431xx.s
|
||||
|
||||
|
||||
######################################
|
||||
# firmware library
|
||||
######################################
|
||||
PERIFLIB_SOURCES =
|
||||
|
||||
|
||||
#######################################
|
||||
# binaries
|
||||
#######################################
|
||||
BINPATH = /usr/bin
|
||||
PREFIX = arm-none-eabi-
|
||||
CC = $(BINPATH)/$(PREFIX)gcc
|
||||
CXX = $(BINPATH)/$(PREFIX)g++
|
||||
AS = $(BINPATH)/$(PREFIX)as
|
||||
CP = $(BINPATH)/$(PREFIX)objcopy
|
||||
AR = $(BINPATH)/$(PREFIX)ar
|
||||
SZ = $(BINPATH)/$(PREFIX)size
|
||||
HEX = $(CP) -O ihex
|
||||
BIN = $(CP) -O binary
|
||||
|
||||
#######################################
|
||||
# CFLAGS
|
||||
#######################################
|
||||
# cpu
|
||||
CPU = -mcpu=cortex-m4
|
||||
|
||||
# fpu
|
||||
FPU = -mfpu=fpv4-sp-d16
|
||||
|
||||
# float-abi
|
||||
FLOAT-ABI = -mfloat-abi=hard
|
||||
|
||||
|
||||
# mcu
|
||||
MCU = $(CPU) -mthumb $(FLOAT-ABI) $(FPU)
|
||||
|
||||
# C defines
|
||||
C_DEFS = \
|
||||
-DFW_MAJOR=0 \
|
||||
-DFW_MINOR=1 \
|
||||
-DUSE_FULL_LL_DRIVER \
|
||||
-DHW_REVISION="'B'" \
|
||||
-D__weak="__attribute__((weak))" \
|
||||
-DUSBPD_PORT_COUNT=1 \
|
||||
-DUSBPDCORE_LIB_PD3_FULL \
|
||||
-D_RTOS \
|
||||
-D_SNK \
|
||||
-DUSE_HAL_DRIVER \
|
||||
-DSTM32G431xx \
|
||||
-D__packed="__attribute__((__packed__))"
|
||||
|
||||
# C includes
|
||||
C_INCLUDES = \
|
||||
-IInc \
|
||||
-IApplication/Communication \
|
||||
-IApplication \
|
||||
-IApplication/Drivers \
|
||||
-IApplication/Drivers/USB \
|
||||
-IApplication/Drivers/USB/Core/Inc \
|
||||
-IApplication/Drivers/FPGA \
|
||||
-IDrivers/STM32G4xx_HAL_Driver/Inc \
|
||||
-IDrivers/STM32G4xx_HAL_Driver/Inc/Legacy \
|
||||
-IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \
|
||||
-IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc \
|
||||
-IDrivers/CMSIS/Device/ST/STM32G4xx/Include \
|
||||
-IDrivers/CMSIS/Include \
|
||||
-IMiddlewares/Third_Party/FreeRTOS/Source/include \
|
||||
-IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS \
|
||||
-IMiddlewares/ST/STM32_USBPD_Library/Core/inc \
|
||||
-IMiddlewares/ST/STM32_USBPD_Library/Devices/STM32G4XX/inc
|
||||
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
OPT += -g3 #-gdwarf-2
|
||||
endif
|
||||
|
||||
# compile gcc flags
|
||||
ASFLAGS = $(MCU) -g
|
||||
|
||||
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fmessage-length=0 -ffunction-sections -fdata-sections -c
|
||||
CXXFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fmessage-length=0 -ffunction-sections -fdata-sections -c -fno-exceptions -fno-rtti
|
||||
|
||||
|
||||
|
||||
|
||||
# Generate dependency information
|
||||
CFLAGS += -MMD -MP
|
||||
CXXFLAGS += -MMD -MP
|
||||
|
||||
|
||||
#######################################
|
||||
# LDFLAGS
|
||||
#######################################
|
||||
# link script
|
||||
LDSCRIPT = STM32G431CBUx_FLASH.ld
|
||||
|
||||
# libraries
|
||||
LIBS = -lm -l:USBPDCORE_PD3_FULL_CM4_wc32.a
|
||||
LIBDIR = -LMiddlewares/ST/STM32_USBPD_Library/Core/lib
|
||||
LDFLAGS = $(MCU) -specs=nosys.specs -specs=nano.specs $(LIBDIR) -T$(LDSCRIPT) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map -Wl,--gc-sections -fno-exceptions -fno-rtti
|
||||
|
||||
# default action: build all
|
||||
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
|
||||
|
||||
|
||||
#######################################
|
||||
# build the application
|
||||
#######################################
|
||||
# list of objects
|
||||
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
|
||||
vpath %.c $(sort $(dir $(C_SOURCES)))
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CXX_SOURCES:.cpp=.o)))
|
||||
vpath %.cpp $(sort $(dir $(CXX_SOURCES)))
|
||||
# list of ASM program objects
|
||||
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
|
||||
vpath %.s $(sort $(dir $(ASM_SOURCES)))
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
|
||||
$(CXX) $(CXXFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
||||
$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
$(SZ) $@
|
||||
|
||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(HEX) $< $@
|
||||
|
||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
$(BIN) $< $@
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir $@
|
||||
|
||||
#######################################
|
||||
# clean up
|
||||
#######################################
|
||||
clean:
|
||||
-rm -fR $(BUILD_DIR)
|
||||
|
||||
#######################################
|
||||
# dependencies
|
||||
#######################################
|
||||
DEPS := $(OBJECTS:.o=.d)
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
# *** EOF ***
|
Loading…
Reference in New Issue
Block a user