Commit 6865ed43 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

gps: Added application, now under FreeRTOS

Note: the application still doesn't show the coordinates, just UTC
time received from sattellites.
parent ec744307
......@@ -43,9 +43,7 @@
#include <em_leuart.h>
#include <em_gpio.h>
#include "usbdbg.h"
#include "gps.h"
#include "drivers/gps/gps.h"
#include "nmea/nmea.h"
#define GPS_OK_TO_SEND "$PSRF150,1*3E\r\n"
......@@ -79,7 +77,7 @@ void gps_init()
GPIO_PinModeSet(gpioPortF, 5, gpioModePushPull, 1);
GPIO_PinModeSet(gpioPortA, 1, gpioModeInput, 0);
GPIO_PinModeSet(gpioPortE, 13, gpioModePushPull, 0);
for (i = 0; i < 10000000; i++)
for (i = 0; i < 100000; i++)
;
gps_on_off_pulse();
......@@ -89,7 +87,6 @@ void gps_init()
GPIO_PinModeSet(gpioPortE, 14, gpioModePushPull, 1);
GPIO_PinModeSet(gpioPortE, 15, gpioModeInput, 0);
CMU_ClockEnable(cmuClock_CORELE, true);
CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_LFXO);
CMU_ClockEnable(cmuClock_LEUART0, true);
CMU_ClockDivSet(cmuClock_LEUART0, cmuClkDiv_1);
......@@ -123,11 +120,9 @@ void gps_on_off_pulse()
/* Pulse */
GPIO_PinOutSet(gpioPortE, 13);
GPIO_PinOutSet(gpioPortE, 12);
for (i = 0; i < 100000; i++)
;
GPIO_PinOutClear(gpioPortE, 13);
GPIO_PinOutClear(gpioPortE, 12);
/* Delay to make sure GPS module sees this as a pulse */
for (i = 0; i < 100000; i++)
;
......
......@@ -12,52 +12,14 @@
#include "nmea/time.h"
#ifdef NMEA_WIN
# pragma warning(disable: 4201)
# pragma warning(disable: 4214)
# pragma warning(disable: 4115)
# include <windows.h>
# pragma warning(default: 4201)
# pragma warning(default: 4214)
# pragma warning(default: 4115)
#else
# include <time.h>
#endif
#ifdef NMEA_WIN
void nmea_time_now(nmeaTIME *stm)
{
SYSTEMTIME st;
GetSystemTime(&st);
stm->year = st.wYear - 1900;
stm->mon = st.wMonth - 1;
stm->day = st.wDay;
stm->hour = st.wHour;
stm->min = st.wMinute;
stm->sec = st.wSecond;
stm->hsec = st.wMilliseconds / 10;
}
#else /* NMEA_WIN */
void nmea_time_now(nmeaTIME *stm)
{
time_t lt;
struct tm *tt;
time(&lt);
tt = gmtime(&lt);
stm->year = tt->tm_year;
stm->mon = tt->tm_mon;
stm->day = tt->tm_mday;
stm->hour = tt->tm_hour;
stm->min = tt->tm_min;
stm->sec = tt->tm_sec;
stm->year = 0;
stm->mon = 0;
stm->day = 0;
stm->hour = 0;
stm->min = 0;
stm->sec = 0;
stm->hsec = 0;
}
#endif
......@@ -251,7 +251,7 @@ void lcd_set_pixel(uint8_t x, uint8_t y, uint8_t value)
#ifdef LCD_ROTATE
uint8_t mask = 1 << (y & 0x07);
uint16_t offset = ((LCD_WIDTH - x) * LCD_STRIDE) + (y >> 3);
uint16_t offset = ((LCD_WIDTH - x - 1) * LCD_STRIDE) + (y >> 3);
#else
uint8_t mask = 1 << (x & 0x07); // == 1 << (x % 8)
uint16_t offset = (y * LCD_STRIDE) + (x >> 3); // == y * LCD_STRIDE + x / 8
......@@ -270,7 +270,7 @@ void lcd_toggle_pixel(uint8_t x, uint8_t y)
#ifdef LCD_ROTATE
uint8_t mask = 1 << (y & 0x07);
uint16_t offset = ((LCD_WIDTH - x) * LCD_STRIDE) + (y >> 3);
uint16_t offset = ((LCD_WIDTH - x - 1) * LCD_STRIDE) + (y >> 3);
#else
uint8_t mask = 1 << (x & 0x07); // == 1 << (x % 8)
uint16_t offset = (y * LCD_STRIDE) + (x >> 3); // == y * LCD_STRIDE + x / 8
......@@ -286,7 +286,7 @@ uint8_t lcd_get_pixel(uint8_t x, uint8_t y)
#ifdef LCD_ROTATE
uint8_t mask = 1 << (y & 0x07);
uint16_t offset = ((LCD_WIDTH - x) * LCD_STRIDE) + (y >> 3);
uint16_t offset = ((LCD_WIDTH - x - 1) * LCD_STRIDE) + (y >> 3);
#else
uint8_t mask = 1 << (x & 0x07); // == 1 << (x % 8)
uint16_t offset = (y * LCD_STRIDE) + (x >> 3); // == y * LCD_STRIDE + x / 8
......
/*
* Copyright (C) 2014 Julian Lewis
* @author Matthieu Cattin <matthieu.cattin@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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
* of the License, 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; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @brief Real time clock routines.
*/
#include "rtc.h"
#include <em_burtc.h>
#include <em_rmu.h>
#include <em_cmu.h>
#define LFXO_FREQUENCY 32768
#define WAKEUP_INTERVAL_MS 1200
#define BURTC_COUNT_BETWEEN_WAKEUP (((LFXO_FREQUENCY * WAKEUP_INTERVAL_MS) / 1000)-1)
struct rtc_time time = {0, 0};
__attribute__((weak))
void BURTC_IRQHandler(void)
{
rtc_tick();
BURTC_IntClear(BURTC_IFC_COMP0);
}
void rtc_init(void)
{
// Enable LFXO and select it for LFA branch
CMU_OscillatorEnable(cmuOsc_LFXO, true, true);
CMU_ClockSelectSet(cmuClock_LFA, cmuSelect_LFXO);
// Enable low energy clocking module clock
CMU_ClockEnable(cmuClock_CORELE, true);
// Enable BURTC registers access
RMU_ResetControl(rmuResetBU, false);
BURTC_Init_TypeDef burtcInit = BURTC_INIT_DEFAULT;
burtcInit.enable = true; // Enable BURTC after initialization
burtcInit.mode = burtcModeEM3; // BURTC is enabled in EM0-EM3
burtcInit.debugRun = false; // Counter shall keep running during debug halt.
burtcInit.clkSel = burtcClkSelLFXO; // Select LFXO as clock source
burtcInit.clkDiv = burtcClkDiv_1; // Clock prescaler
burtcInit.lowPowerComp = 0; // Number of least significantt clock bits to ignore in low power mode
burtcInit.timeStamp = true; // Enable time stamp on entering backup power domain
burtcInit.compare0Top = true; // Clear counter on compare match
burtcInit.lowPowerMode = burtcLPDisable; // Low power operation mode, requires LFXO or LFRCO
BURTC_CompareSet(0, BURTC_COUNT_BETWEEN_WAKEUP); // Set top value for comparator
// Enabling Interrupt from BURTC
NVIC_EnableIRQ(BURTC_IRQn);
BURTC_IntEnable(BURTC_IF_COMP0); // Enable compare interrupt flag
// Initialize BURTC
BURTC_Init(&burtcInit);
}
struct rtc_time rtc_get_time(void)
{
return time;
}
void rtc_set_time(struct rtc_time current)
{
time = current;
}
void rtc_tick(void)
{
++time.epoch;
time.msecs += 200;
if(time.msecs == 1000) {
++time.epoch;
time.msecs = 0;
}
}
/*
* Copyright (C) 2014 Julian Lewis
* @author Matthieu Cattin <matthieu.cattin@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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
* of the License, 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; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @brief Real time clock routines.
*/
#ifndef RTC_H
#define RTC_H
struct rtc_time {
///> Seconds since 01-01-1970 00:00
unsigned int epoch;
///> Milliseconds
unsigned int msecs;
};
/**
* @brief Setup backup RTC
* Using LFRCO clock source and enabling interrupt on COMP0 match
*/
void rtc_init(void);
/**
* @brief Returns the current time.
*/
struct rtc_time rtc_get_time(void);
/**
* @brief Sets the time.
*/
void rtc_set_time(struct rtc_time current);
/**
* @brief Function to be called on every timer tick in the interrupt
* servicer routine.
*/
void rtc_tick(void);
#endif /* RTC_H */
......@@ -12,7 +12,8 @@
DEVICE = EFM32GG330F1024
PROJECTNAME = freertos
# Name of interface configuration file used by OpenOCD
OOCD_IFACE ?= stlink-v2-1
#OOCD_IFACE ?= stlink-v2-1
OOCD_IFACE ?= stlink-v2
OBJ_DIR = build
EXE_DIR = exe
......@@ -118,6 +119,7 @@ INCLUDEPATHS += \
-I../common \
-I../common/emlib/inc \
-I../common/emdrv/sleep/inc \
-I../common/drivers/gps/nmealib/include
####################################################################
# Files #
......@@ -136,6 +138,7 @@ C_SRC += \
../common/emlib/src/em_rtc.c \
../common/emlib/src/em_system.c \
../common/emlib/src/em_usart.c \
../common/emlib/src/em_leuart.c \
../common/emdrv/sleep/src/sleep.c \
../common/drivers/lcd.c \
../common/drivers/buttons.c \
......@@ -170,7 +173,19 @@ src/apps/menu.c \
src/apps/menu_struct.c \
src/main.c \
src/irq_dispatcher.c \
src/low_power_tick_management.c
src/low_power_tick_management.c \
../common/drivers/gps/nmealib/src/context.c \
../common/drivers/gps/nmealib/src/generate.c \
../common/drivers/gps/nmealib/src/generator.c \
../common/drivers/gps/nmealib/src/gmath.c \
../common/drivers/gps/nmealib/src/info.c \
../common/drivers/gps/nmealib/src/parse.c \
../common/drivers/gps/nmealib/src/parser.c \
../common/drivers/gps/nmealib/src/sentence.c \
../common/drivers/gps/nmealib/src/time.c \
../common/drivers/gps/nmealib/src/tok.c \
../common/drivers/gps/gps.c \
src/apps/gpscoord.c
s_SRC +=
......
......@@ -32,6 +32,7 @@
extern application menu;
extern application clock;
extern application example;
extern application gpscoord;
#endif /* APP_LIST_H */
/*
*==============================================================================
* CERN (BE-CO-HT)
* Source file for GPS app
*==============================================================================
* Copyright (C) 2014 Julian Lewis
* @author Theodor Stana <theodor.stana@gmail.com>
*
* author: Theodor Stana (t.stana@cern.ch)
* 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
* of the License, or (at your option) any later version.
*
* date of creation: 2014-08-14
* 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.
*
* version: 1.0
*
* description:
*
* dependencies:
*
* references:
*
*==============================================================================
* GNU LESSER GENERAL PUBLIC LICENSE
*==============================================================================
* This source file is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version. This source 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 Lesser General Public License for more details. You should have
* received a copy of the GNU Lesser General Public License along with this
* source; if not, download it from http://www.gnu.org/licenses/lgpl-2.1.html
*==============================================================================
* last changes:
* 2014-08-14 Theodor Stana File created
*==============================================================================
* TODO: -
*==============================================================================
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <string.h>
#include <stdio.h>
#include <em_device.h>
#include <em_cmu.h>
#include <em_usb.h>
#include <em_leuart.h>
#include <em_gpio.h>
#include <event.h>
#include <drivers/lcd.h>
#include <gfx/graphics.h>
#include <gfx/ui.h>
#include "widgets/status_bar.h"
#include <bitmaps.h>
#include "gps.h"
#include <drivers/gps/gps.h>
#include "application.h"
static struct rle_bitmap gps_ico;
static int gps_ico_blink = 0;
static int asdf = 0;
static void gps_redraw(struct ui_widget *w)
{
char buf[16];
......@@ -65,6 +48,8 @@ static void gps_redraw(struct ui_widget *w)
gps_get_utc(&utc);
asdf++;
gfx_clear(&w->dc, 0);
sprintf(buf, "%d:%d:%d", utc.hr,
utc.min,
......@@ -103,27 +88,11 @@ static struct ui_widget gps_screen = {
WF_ACTIVE | WF_VISIBLE
};
void main(void *params)
void gpscoord_main(void *params)
{
struct event evt;
int i = 0;
/* Init clocks */
// TODO: move to common init
CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
CMU_ClockEnable(cmuClock_HFPER, true);
CMU_ClockEnable(cmuClock_GPIO, true);
GPIO_PinModeSet(gpioPortE, 11, gpioModePushPull, 0);
GPIO_PinModeSet(gpioPortE, 12, gpioModePushPull, 0);
/* Initialize GPS module */
gps_init();
// TODO: remove, this is done in startMain()
lcd_init();
ui_init();
/* Init UI */
ui_clear();
......@@ -134,22 +103,34 @@ void main(void *params)
ui_add_widget(&gps_coord_display);
ui_add_child(&gps_screen, &gps_coord_display);
// ui_init_widget(&status_bar);
// ui_add_widget(&status_bar);
ui_init_widget(&status_bar);
ui_add_widget(&status_bar);
ui_update(NULL);
while (1) {
for (i = 0; i < 100000; i++)
;
if (gps_fixed()) {
evt.type = GPS_FIX_ACQ;
ui_update(&evt);
} else {
evt.type = GPS_FIX_LOST;
ui_update(&evt);
if (xQueueReceive(appQueue, &evt, 0)) {
switch (evt.type) {
case BUTTON_PRESSED:
if (evt.data.button == BUT_TR)
return;
break;
case RTC_TICK:
ui_update(&evt);
}
}
//if (gps_fixed()) {
// evt.type = GPS_FIX_ACQ;
// ui_update(&evt);
//} else {
// evt.type = GPS_FIX_LOST;
// ui_update(&evt);
//}
}
}
application gpscoord = {
.name = "uerdefucami",
.main = gpscoord_main
};
......@@ -51,7 +51,7 @@ menu_list main_menu = {
"Main menu",
{
{ APP, &example_icon, { .app = &example } },
{ APP, &gps_receiving, { .app = &clock } },
{ APP, &gps_receiving, { .app = &gpscoord } },
{ APP, &battery_charging, { .app = &clock } },
{ SUBMENU, NULL, { .submenu = &sub_menu } },
{ APP, &battery, { .app = &clock } },
......
......@@ -34,6 +34,7 @@
#include <drivers/lcd.h>
#include <drivers/rtc.h>
#include <gfx/ui.h>
#include <drivers/gps/gps.h>
int main(void)
{
......@@ -41,6 +42,7 @@ int main(void)
CHIP_Init();
// Enable clocks
CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
CMU_ClockEnable(cmuClock_HFPER, true);
CMU_ClockEnable(cmuClock_GPIO, true);
......@@ -48,6 +50,7 @@ int main(void)
rtc_init();
lcd_init();
ui_init();
gps_init();
GPIO_PinModeSet(gpioPortE, 11, gpioModePushPull, 0);
GPIO_PinModeSet(gpioPortE, 12, gpioModePushPull, 0);
......
####################################################################
# Makefile #
####################################################################
.SUFFIXES: # ignore builtin rules
.PHONY: all debug release clean
####################################################################
# Definitions #
####################################################################
# uniq is a function which remove duplicate elements from a list
uniq = $(strip $(if $1,$(firstword $1) \
$(call uniq,$(filter-out $(firstword $1),$1))))
DEVICE = EFM32GG330F1024
PROJECTNAME = gpsapp
OOCD_IFACE ?= stlink-v2
OBJ_DIR = build
EXE_DIR = exe
LST_DIR = lst
####################################################################
# Definitions of toolchain. #
# You might need to do changes to match your system setup #
####################################################################
# Change path to the tools according to your system configuration
# DO NOT add trailing whitespace chars, they do matter !
WINDOWSCS ?= GNU Tools ARM Embedded\4.8 2013q4
LINUXCS ?= /opt/gcc-arm-none-eabi-4_8-2014q1
RMDIRS := rm -rf
RMFILES := rm -rf
ALLFILES := /*.*
NULLDEVICE := /dev/null
SHELLNAMES := $(ComSpec)$(COMSPEC)
# Try autodetecting the environment
ifeq ($(SHELLNAMES),)
# Assume we are making on a Linux platform
TOOLDIR := $(LINUXCS)
else
QUOTE :="
ifneq ($(COMSPEC),)
# Assume we are making on a mingw/msys/cygwin platform running on Windows
# This is a convenient place to override TOOLDIR, DO NOT add trailing
# whitespace chars, they do matter !
TOOLDIR := $(PROGRAMFILES)/$(WINDOWSCS)
ifeq ($(findstring cygdrive,$(shell set)),)
# We were not on a cygwin platform
NULLDEVICE := NUL
endif
else
# Assume we are making on a Windows platform
# This is a convenient place to override TOOLDIR, DO NOT add trailing
# whitespace chars, they do matter !
SHELL := $(SHELLNAMES)
TOOLDIR := $(ProgramFiles)/$(WINDOWSCS)
RMDIRS := rd /s /q
RMFILES := del /s /q
ALLFILES := \*.*
NULLDEVICE := NUL
endif
endif
# Create directories and do a clean which is compatible with parallell make
$(shell mkdir $(OBJ_DIR)>$(NULLDEVICE) 2>&1)
$(shell mkdir $(EXE_DIR)>$(NULLDEVICE) 2>&1)
$(shell mkdir $(LST_DIR)>$(NULLDEVICE) 2>&1)
ifeq (clean,$(findstring clean, $(MAKECMDGOALS)))
ifneq ($(filter $(MAKECMDGOALS),all debug release),)
$(shell $(RMFILES) $(OBJ_DIR)$(ALLFILES)>$(NULLDEVICE) 2>&1)
$(shell $(RMFILES) $(EXE_DIR)$(ALLFILES)>$(NULLDEVICE) 2>&1)
$(shell $(RMFILES) $(LST_DIR)$(ALLFILES)>$(NULLDEVICE) 2>&1)
endif
endif
CC = $(QUOTE)$(TOOLDIR)/bin/arm-none-eabi-gcc$(QUOTE)
LD = $(QUOTE)$(TOOLDIR)/bin/arm-none-eabi-ld$(QUOTE)
AR = $(QUOTE)$(TOOLDIR)/bin/arm-none-eabi-ar$(QUOTE)
OBJCOPY = $(QUOTE)$(TOOLDIR)/bin/arm-none-eabi-objcopy$(QUOTE)
DUMP = $(QUOTE)$(TOOLDIR)/bin/arm-none-eabi-objdump$(QUOTE)
SIZE = $(QUOTE)$(TOOLDIR)/bin/arm-none-eabi-size$(QUOTE)
####################################################################
# Flags #
####################################################################
# -MMD : Don't generate dependencies on system header files.
# -MP : Add phony targets, useful when a h-file is removed from a project.
# -MF : Specify a file to write the dependencies to.
DEPFLAGS = -MMD -MP -MF $(@:.o=.d)
# Add -Wa,-ahld=$(LST_DIR)/$(@F:.o=.lst) to CFLAGS to produce assembly list files
#
override CFLAGS += -D$(DEVICE) -Wall -Wextra -mcpu=cortex-m3 -mthumb \
-mfix-cortex-m3-ldrd -ffunction-sections \
-fdata-sections -fomit-frame-pointer -DDEBUG_EFM_USER \
$(DEPFLAGS)
override ASMFLAGS += -x assembler-with-cpp -D$(DEVICE) -Wall -Wextra -mcpu=cortex-m3 -mthumb -DDEBUG_EFM_USER
#
# NOTE: The -Wl,--gc-sections flag may interfere with debugging using gdb.
#
override LDFLAGS += -Xlinker -Map=$(LST_DIR)/$(PROJECTNAME).map -mcpu=cortex-m3 \
-mthumb -T../common/Device/EnergyMicro/EFM32GG/Source/GCC/efm32gg.ld \
-Wl,--gc-sections
LIBS = -Wl,--start-group -lgcc -lc -lnosys -Wl,--end-group
INCLUDEPATHS += \
-I../common/CMSIS/Include \
-I../common/Device/EnergyMicro/EFM32GG/Include \
-I../common/emlib/inc \
-I../common/ \
-I../common/drivers/usb \
-I../common/drivers/usb/inc \
-I../common/drivers/gps/ \
-I../common/drivers/gps/nmealib/include \
-I../bitmaps/
####################################################################
# Files #
####################################################################
C_SRC += \
../common/Device/EnergyMicro/EFM32GG/Source/system_efm32gg.c \
../common/emlib/src/em_assert.c \
../common/emlib/src/em_cmu.c \
../common/emlib/src/em_dma.c \
../common/emlib/src/em_ebi.c \
../common/emlib/src/em_emu.c \
../common/emlib/src/em_gpio.c \
../common/emlib/src/em_int.c \
../common/emlib/src/em_system.c \
../common/emlib/src/em_timer.c \
../common/emlib/src/em_leuart.c \
../common/emlib/src/em_rtc.c \
../common/drivers/usb/usbdbg.c \
../common/drivers/usb/src/em_usbd.c \
../common/drivers/usb/src/em_usbdch9.c \
../common/drivers/usb/src/em_usbhal.c \
../common/drivers/usb/src/em_usbdep.c \
../common/drivers/usb/src/em_usbdint.c \
../common/drivers/usb/src/em_usbtimer.c \
../common/drivers/usb/src/em_usart.c \
../common/drivers/gps/nmealib/src/context.c \
../common/drivers/gps/nmealib/src/generate.c \
../common/drivers/gps/nmealib/src/generator.c \
../common/drivers/gps/nmealib/src/gmath.c \
../common/drivers/gps/nmealib/src/info.c \
../common/drivers/gps/nmealib/src/parse.c \
../common/drivers/gps/nmealib/src/parser.c \
../common/drivers/gps/nmealib/src/sentence.c \
../common/drivers/gps/nmealib/src/time.c \
../common/drivers/gps/nmealib/src/tok.c \
../common/drivers/gps/gps.c \
../common/drivers/lcd.c \
../common/gfx/gfx.c \
../common/gfx/graphics.c \
../common/gfx/ui.c \
../common/gfx/font_helv11.c \
../common/gfx/font_helv17.c \
../common/gfx/font_helv17b.c \
../common/gfx/font_helv22b.c \
../common/gfx/font_helv29.c \
../common/gfx/font_helv38b.c \
../common/gfx/font_luct38.c \
../common/gfx/font_xm16x25b.c \
../common/gfx/font_xm4x5.c \
../common/gfx/font_xm4x6.c \
../common/gfx/font_xm5x8.c \
../common/udelay.c \
../bitmaps/bitmaps.c \
gpsapp.c
s_SRC +=
S_SRC += ../common/Device/EnergyMicro/EFM32GG/Source/GCC/startup_efm32gg.S
####################################################################
# Rules #
####################################################################
C_FILES = $(notdir $(C_SRC) )
S_FILES = $(notdir $(S_SRC) $(s_SRC) )
#make list of source paths, uniq removes duplicate paths
C_PATHS = $(call uniq, $(dir $(C_SRC) ) )
S_PATHS = $(call uniq, $(dir $(S_SRC) $(s_SRC) ) )
C_OBJS = $(addprefix $(OBJ_DIR)/, $(C_FILES:.c=.o))
S_OBJS = $(if $(S_SRC), $(addprefix $(OBJ_DIR)/, $(S_FILES:.S=.o)))
s_OBJS = $(if $(s_SRC), $(addprefix $(OBJ_DIR)/, $(S_FILES:.s=.o)))
C_DEPS = $(addprefix $(OBJ_DIR)/, $(C_FILES:.c=.d))
OBJS = $(C_OBJS) $(S_OBJS) $(s_OBJS)
vpath %.c $(C_PATHS)
vpath %.s $(S_PATHS)
vpath %.S $(S_PATHS)
# Default build is debug build
all: debug
debug: CFLAGS += -DDEBUG -O0 -g
debug: $(EXE_DIR)/$(PROJECTNAME).bin
release: CFLAGS += -DNDEBUG -O0 -g
release: $(EXE_DIR)/$(PROJECTNAME).bin
# Create objects from C SRC files
$(OBJ_DIR)/%.o: %.c
@echo "Building file: $<"
$(CC) $(CFLAGS) $(INCLUDEPATHS) -c -o $@ $<
# Assemble .s/.S files
$(OBJ_DIR)/%.o: %.s
@echo "Assembling $<"
$(CC) $(ASMFLAGS) $(INCLUDEPATHS) -c -o $@ $<
$(OBJ_DIR)/%.o: %.S
@echo "Assembling $<"
$(CC) $(ASMFLAGS) $(INCLUDEPATHS) -c -o $@ $<
# Link
$(EXE_DIR)/$(PROJECTNAME).out: $(OBJS)
@echo "Linking target: $@"
$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $(EXE_DIR)/$(PROJECTNAME).out
# Create binary file
$(EXE_DIR)/$(PROJECTNAME).bin: $(EXE_DIR)/$(PROJECTNAME).out
@echo "Creating binary file"
$(OBJCOPY) -O binary $(EXE_DIR)/$(PROJECTNAME).out $(EXE_DIR)/$(PROJECTNAME).bin
# Uncomment next line to produce assembly listing of entire program
# $(DUMP) -h -S -C $(EXE_DIR)/$(PROJECTNAME).out>$(LST_DIR)/$(PROJECTNAME)out.lst
$(SIZE) $<
clean:
ifeq ($(filter $(MAKECMDGOALS),all debug release),)
$(RMDIRS) $(OBJ_DIR) $(LST_DIR) $(EXE_DIR)
endif
flash: $(EXE_DIR)/$(PROJECTNAME).bin
openocd -s ../common/openocd -f interface/$(OOCD_IFACE).cfg -f init.cfg -c "program $(EXE_DIR)/$(PROJECTNAME).bin 0 verify reset"
# include auto-generated dependency files (explicit rules)
ifneq (clean,$(findstring clean, $(MAKECMDGOALS)))
-include $(C_DEPS)
endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment