Skip to content

Commit

Permalink
Added HydraFW version using git tag infos.
Browse files Browse the repository at this point in the history
Added rules, ld and warnings fixed.
  • Loading branch information
bvernoux committed Oct 9, 2014
1 parent ad53bb1 commit ea80a02
Show file tree
Hide file tree
Showing 10 changed files with 5,042 additions and 5,287 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
USE_OPT = -Os -ggdb -fomit-frame-pointer -falign-functions=16
endif

# C specific options here (added to USE_OPT).
Expand Down Expand Up @@ -65,7 +65,7 @@ endif

# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
USE_FPU = hard
endif

#
Expand Down Expand Up @@ -95,7 +95,7 @@ include hydrabus/hydrabus.mk
include hydranfc/hydranfc.mk

# Define linker script file here and link with lib nano
LDSCRIPT= $(PORTLD)/STM32F405xG.ld
LDSCRIPT= hydrafw_STM32F405xG.ld

# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
Expand All @@ -114,7 +114,7 @@ CSRC = $(PORTSRC) \
$(CHIBIOS)/os/various/chprintf.c \
$(CHIBIOS)/os/various/memstreams.c \
./microrl/src/microrl.c \
main.c \
main.c

# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
Expand Down Expand Up @@ -217,5 +217,4 @@ ULIBS =
# End of user defines
##############################################################################

RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
include hydrafw_rules.mk
Binary file modified build/hydrafw.dfu
Binary file not shown.
9,800 changes: 4,525 additions & 5,275 deletions build/hydrafw.hex

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

#include "hydrabus.h"
#include "hydranfc.h"
#include "hydrafw_version.hdr"

#define HYDRABUS_VERSION "HydraFW (HydraBus/HydraNFC) v0.1Beta 21 Sept 2014"
#define HYDRAFW_VERSION "HydraFW (HydraBus/HydraNFC) " HYDRAFW_GIT_TAG " " HYDRAFW_GIT_HASH " " HYDRAFW_BUILD_DATE

#define TEST_WA_SIZE THD_WORKING_AREA_SIZE(256)

Expand Down Expand Up @@ -140,7 +141,7 @@ void cmd_init(BaseSequentialStream *chp, int argc, const char* const* argv)
chprintf(chp, "argv[%d]=%s\r\n", i, argv[i]);
}

chprintf(chp, "%s\r\n", HYDRABUS_VERSION);
chprintf(chp, "%s\r\n", HYDRAFW_VERSION);

cycles_start = get_cyclecounter();
DelayUs(10000);
Expand Down
4 changes: 1 addition & 3 deletions common/microrl_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ typedef struct
ptFunc ptFunc_exe_cmd;
} microrl_exec_t;

int execute(void* user_handle, int argc, const char* const* argv);

// print to stream callback
void print(void* user_handle, const char * str);

// get_char from stream
char get_char(void* user_handle);

// execute callback
int execute(void* user_handle, int argc, const char* const* argv);
unsigned int execute(void* user_handle, int argc, const char* const* argv);

// completion callback
char ** complet(void* user_handle, int argc, const char* const* argv);
Expand Down
2 changes: 1 addition & 1 deletion common/microrl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ char** complet(void* user_handle, int argc, const char * const * argv)
//*****************************************************************************
// execute callback for microrl library
// do what you want here, but don't write to argv!!! read only!!
int execute(void* user_handle, int argc, const char* const* argv)
unsigned int execute(void* user_handle, int argc, const char* const* argv)
{
/* HydraNFC Shield detected*/
if(hydranfc_is_detected() == TRUE)
Expand Down
19 changes: 19 additions & 0 deletions hydrafw-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

# Note: git describe doesn't work if no tag is available
git_tag="$(git describe --tags --always)"
git_hash="$(git rev-parse --short HEAD 2> /dev/null || echo unknown)"
git_files_are_clean=1
# Check if there are any modified files.
git diff --no-ext-diff --quiet --exit-code 2> /dev/null || git_files_are_clean=0
# Check if there are any staged files.
git diff-index --cached --quiet HEAD -- 2> /dev/null || git_files_are_clean=0
if [ "${git_files_are_clean}" != "1" ]; then
git_hash="${git_hash}-dirty"
fi
cat <<EOF
// This file was generated by hydrafw-version.sh
#define HYDRAFW_GIT_TAG "${git_tag}"
#define HYDRAFW_GIT_HASH "${git_hash}"
#define HYDRAFW_BUILD_DATE "$(date '+%Y-%m-%d')"
EOF
32 changes: 32 additions & 0 deletions hydrafw_STM32F405xG.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
ChibiOS - Copyright (C) 2006,2007,2008,2009,2010,
2011,2012,2013,2014 Giovanni Di Sirio.

This file is part of ChibiOS.

ChibiOS 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 3 of the License, or
(at your option) any later version.

ChibiOS 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, see <https://www.gnu.org/licenses/>.
*/

/*
* STM32F405xG memory setup.
*/
MEMORY
{
flash : org = 0x08000000, len = 1M
ram : org = 0x20000000, len = 112k
ethram : org = 0x2001C000, len = 16k
ccmram : org = 0x10000000, len = 64k
}

INCLUDE hydrafw_rules.ld
141 changes: 141 additions & 0 deletions hydrafw_rules.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/*
ChibiOS - Copyright (C) 2006,2007,2008,2009,2010,
2011,2012,2013,2014 Giovanni Di Sirio.

This file is part of ChibiOS.

ChibiOS 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 3 of the License, or
(at your option) any later version.

ChibiOS 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, see <https://www.gnu.org/licenses/>.
*/

__ram_start__ = ORIGIN(ram);
__ram_size__ = LENGTH(ram);
__ram_end__ = __ram_start__ + __ram_size__;

ENTRY(Reset_Handler)

SECTIONS
{
. = 0;
_text = .;

startup : ALIGN(16) SUBALIGN(16)
{
KEEP(*(vectors))
} > flash

constructors : ALIGN(4) SUBALIGN(4)
{
PROVIDE(__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE(__init_array_end = .);
} > flash

destructors : ALIGN(4) SUBALIGN(4)
{
PROVIDE(__fini_array_start = .);
KEEP(*(.fini_array))
KEEP(*(SORT(.fini_array.*)))
PROVIDE(__fini_array_end = .);
} > flash

.text : ALIGN(16) SUBALIGN(16)
{
*(.text.startup.*)
*(.text)
*(.text.*)
*(.rodata)
*(.rodata.*)
*(.glue_7t)
*(.glue_7)
*(.gcc*)
} > flash

.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > flash

.ARM.exidx : {
PROVIDE(__exidx_start = .);
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
PROVIDE(__exidx_end = .);
} > flash

.eh_frame_hdr :
{
*(.eh_frame_hdr)
} > flash

.eh_frame : ONLY_IF_RO
{
*(.eh_frame)
} > flash

.textalign : ONLY_IF_RO
{
. = ALIGN(8);
} > flash

. = ALIGN(4);
_etext = .;
_textdata = _etext;

.stacks :
{
. = ALIGN(8);
__main_stack_base__ = .;
. += __main_stack_size__;
. = ALIGN(8);
__main_stack_end__ = .;
__process_stack_base__ = .;
__main_thread_stack_base__ = .;
. += __process_stack_size__;
. = ALIGN(8);
__process_stack_end__ = .;
__main_thread_stack_end__ = .;
} > ram

.data :
{
. = ALIGN(4);
PROVIDE(_data = .);
*(.data)
. = ALIGN(4);
*(.data.*)
. = ALIGN(4);
*(.ramtext)
. = ALIGN(4);
PROVIDE(_edata = .);
} > ram AT > flash

.bss :
{
. = ALIGN(4);
PROVIDE(_bss_start = .);
*(.bss)
. = ALIGN(4);
*(.bss.*)
. = ALIGN(4);
*(COMMON)
. = ALIGN(4);
PROVIDE(_bss_end = .);
} > ram
}

PROVIDE(end = .);
_end = .;

__heap_base__ = _end;
__heap_end__ = __ram_end__;
Loading

0 comments on commit ea80a02

Please sign in to comment.